/* CMBR CRM — base styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: system-ui, sans-serif; font-size: 14px; color: #1a1a1a; display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 180px; min-height: 100vh; background: #1e293b; color: #e2e8f0; display: flex; flex-direction: column; padding: 16px 0; flex-shrink: 0; }
.sidebar-logo { font-weight: 700; font-size: 15px; padding: 0 16px 20px; color: #fff; }
.sidebar ul { list-style: none; flex: 1; }
.sidebar ul li a { display: block; padding: 8px 16px; color: #94a3b8; text-decoration: none; }
.sidebar ul li a:hover, .sidebar ul li a.active { background: #334155; color: #fff; }
.sidebar-footer { padding: 16px; font-size: 12px; color: #64748b; display: flex; justify-content: space-between; }
.sidebar-footer a { color: #64748b; text-decoration: none; }
.sidebar-footer a:hover { color: #fff; }

/* Main */
.main-content { flex: 1; padding: 24px; overflow: auto; }
.page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.page-header h2 { font-size: 20px; font-weight: 600; }
.header-actions { display: flex; gap: 8px; margin-left: auto; }

/* Login */
.login-body { background: #f1f5f9; justify-content: center; align-items: center; }
.login-card { background: #fff; padding: 40px; border-radius: 8px; width: 340px; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.login-card h1 { font-size: 22px; margin-bottom: 24px; }
.login-card label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; margin-top: 14px; }
.login-card input { width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 14px; }
.login-card button { width: 100%; margin-top: 20px; padding: 10px; background: #2563eb; color: #fff; border: none; border-radius: 4px; font-size: 14px; cursor: pointer; }
.login-card button:hover { background: #1d4ed8; }
.error { color: #dc2626; font-size: 13px; margin-bottom: 8px; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid #e2e8f0; font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; }
.data-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; }
.data-table tr.clickable-row:hover { background: #f8fafc; cursor: pointer; }
.empty { color: #94a3b8; font-style: italic; }

/* Search */
.search-form input { padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 4px; width: 260px; }

/* Pill */
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.pill.member { background: #dcfce7; color: #166534; }

/* Side panel */
.panel-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 100; }
.panel-overlay.open { display: block; }
.detail-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 100vw; background: #fff; box-shadow: -4px 0 24px rgba(0,0,0,.15); z-index: 101; transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column; }
.detail-panel.open { transform: translateX(0); }
#panel-body { display: flex; flex-direction: column; flex: 1; overflow-y: auto; }
.panel-header { background: #1e293b; color: #fff; padding: 16px 20px; display: flex; align-items: flex-start; gap: 12px; flex-shrink: 0; }
.panel-name { font-size: 17px; font-weight: 700; line-height: 1.2; }
.panel-email { font-size: 13px; opacity: .75; margin-top: 3px; }
.panel-header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.panel-close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px; opacity: .7; }
.panel-close:hover { opacity: 1; background: none; }
.panel-content { padding: 16px 20px; flex: 1; }
.panel-section { margin-bottom: 18px; }
.panel-section h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #64748b; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid #f1f5f9; }
.info-grid { display: grid; grid-template-columns: 120px 1fr; gap: 5px 12px; font-size: 13px; }
.info-grid dt { color: #64748b; font-size: 12px; padding-top: 1px; }
.info-grid dd { font-weight: 500; word-break: break-word; }
.panel-notes { font-size: 13px; color: #374151; line-height: 1.5; white-space: pre-wrap; }
.panel-footer { padding: 12px 20px; border-top: 1px solid #e2e8f0; display: flex; align-items: center; gap: 12px; flex-shrink: 0; background: #fff; }

/* Panel edit form */
.panel-edit-form .panel-section label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 500; color: #374151; margin-bottom: 8px; }
.panel-edit-form input:not([type=checkbox]),
.panel-edit-form textarea { padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 13px; font-family: inherit; width: 100%; }
.panel-edit-form input:not([type=checkbox]):focus,
.panel-edit-form textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.panel-edit-form textarea { min-height: 80px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 60px 90px; gap: 8px; }
.checkbox-label { flex-direction: row !important; align-items: center !important; gap: 8px !important; cursor: pointer; }
.checkbox-label input[type=checkbox] { width: auto !important; }

/* Buttons */
.btn { display: inline-block; padding: 6px 12px; background: #2563eb; color: #fff; border: none; border-radius: 4px; font-size: 13px; cursor: pointer; text-decoration: none; }
.btn:hover { background: #1d4ed8; }
.btn-danger { display: inline-block; padding: 6px 12px; background: #dc2626; color: #fff; border: none; border-radius: 4px; font-size: 13px; cursor: pointer; }
.btn-danger:hover { background: #b91c1c; }
button { padding: 4px 10px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 12px; cursor: pointer; background: #fff; }
button:hover { background: #f1f5f9; }

/* Two-col layout */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-col section h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }

/* Edit form */
.edit-form { max-width: 480px; display: flex; flex-direction: column; gap: 12px; }
.edit-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.edit-form input, .edit-form textarea { padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 14px; font-family: inherit; }
.edit-form textarea { min-height: 80px; resize: vertical; }
