:root {
  --primary: #c91422;
  --primary-hover: #e01929;
  --primary-light: rgba(201, 20, 34, 0.08);
  --ink: #121416;
  --ink-light: #374151;
  --muted: #6b7280;
  --paper: #f9fafb;
  --white: #ffffff;
  --border: #e5e7eb;
  --border-dark: #d1d5db;
  --green: #059669;
  --green-light: rgba(5, 150, 105, 0.1);
  --amber: #d97706;
  --amber-light: rgba(217, 119, 6, 0.1);
  --blue: #2563eb;
  --blue-light: rgba(37, 99, 235, 0.1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--ink); background: var(--paper); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* Layout */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar { background: var(--ink); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-brand { display: flex; align-items: center; }
.sidebar-logo { height: 50px; width: auto; background: #fff; padding: 6px 10px; border-radius: 6px; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-section { margin-bottom: 24px; }
.nav-label { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.4); padding: 0 12px; margin-bottom: 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); color: rgba(255,255,255,0.7); font-size: 14px; font-weight: 500; transition: all 0.15s ease; cursor: pointer; border: none; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .icon { opacity: 0.8; }
.nav-item.active .icon { opacity: 1; }
.nav-badge { margin-left: auto; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.nav-item.active .nav-badge { background: rgba(255,255,255,0.25); }

.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-info { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.user-avatar { width: 36px; height: 36px; background: rgba(255,255,255,0.15); border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.5); }

/* Main Content */
.main { display: flex; flex-direction: column; }

/* Top Bar */
.topbar { height: 64px; background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 18px; font-weight: 700; color: var(--ink); }
.topbar-count { font-size: 13px; color: var(--muted); background: var(--paper); padding: 4px 12px; border-radius: 20px; font-weight: 500; }
.topbar-actions { display: flex; gap: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; height: 40px; border-radius: var(--radius); font-size: 14px; font-weight: 600; border: none; cursor: pointer; transition: all 0.15s ease; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--white); color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--paper); border-color: var(--border-dark); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--paper); color: var(--ink); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn.loading { pointer-events: none; }
.btn.loading .icon { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Content Area */
.content { display: grid; grid-template-columns: 380px 1fr; flex: 1; }

/* List Panel */
.list-panel { background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; height: calc(100vh - 64px); overflow: hidden; }
.list-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.list-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.list-filter { display: flex; gap: 4px; }
.filter-btn { padding: 6px 12px; font-size: 12px; font-weight: 600; border-radius: 6px; border: none; background: transparent; color: var(--muted); cursor: pointer; transition: all 0.15s ease; }
.filter-btn:hover { background: var(--paper); }
.filter-btn.active { background: var(--primary-light); color: var(--primary); }

.list-body { flex: 1; overflow-y: auto; }
.list-empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.list-empty .icon { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.4; }
.list-empty p { font-size: 14px; }

.quote-card { padding: 16px 20px; border-bottom: 1px solid var(--border); cursor: pointer; transition: all 0.15s ease; position: relative; }
.quote-card:hover { background: var(--paper); }
.quote-card.active { background: var(--primary-light); }
.quote-card.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.quote-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.quote-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.quote-status { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.quote-status.new { background: var(--primary-light); color: var(--primary); }
.quote-status.contacted { background: var(--blue-light); color: var(--blue); }
.quote-status.done { background: var(--green-light); color: var(--green); }
.quote-meta { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.quote-service { display: flex; align-items: center; gap: 6px; }
.quote-service .icon { width: 14px; height: 14px; }
.quote-time { font-size: 12px; opacity: 0.8; }

/* Detail Panel */
.detail-panel { background: var(--paper); height: calc(100vh - 64px); overflow-y: auto; }
.detail-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); padding: 40px; }
.detail-empty .icon { width: 64px; height: 64px; margin-bottom: 20px; opacity: 0.3; }
.detail-empty h3 { font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.detail-empty p { font-size: 14px; max-width: 280px; }

.detail-content { padding: 24px; }
.detail-header { background: var(--white); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.detail-header-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.detail-title { font-size: 24px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.detail-submitted { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.detail-submitted .icon { width: 14px; height: 14px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.action-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600; border: 1px solid var(--border); background: var(--white); color: var(--ink); cursor: pointer; transition: all 0.15s ease; }
.action-btn:hover { background: var(--paper); border-color: var(--border-dark); }
.action-btn:active { transform: scale(0.98); }
.action-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.action-btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.action-btn.success { background: var(--green); color: #fff; border-color: var(--green); }
.action-btn .icon { width: 16px; height: 16px; }

.status-buttons { display: flex; gap: 6px; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 16px; }
.status-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--white); cursor: pointer; transition: all 0.15s ease; }
.status-btn:hover { background: var(--paper); border-color: var(--border-dark); }
.status-btn.active { border-width: 2px; }
.status-btn.new.active { border-color: var(--primary); background: var(--primary-light); }
.status-btn.contacted.active { border-color: var(--blue); background: var(--blue-light); }
.status-btn.done.active { border-color: var(--green); background: var(--green-light); }
.status-btn .icon { width: 20px; height: 20px; }
.status-btn.new .icon { color: var(--primary); }
.status-btn.contacted .icon { color: var(--blue); }
.status-btn.done .icon { color: var(--green); }
.status-btn span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); }
.status-btn.active span { color: var(--ink); }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-card { background: var(--white); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.detail-card.full { grid-column: 1 / -1; }
.detail-card-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.detail-card-title .icon { width: 14px; height: 14px; }
.detail-value { font-size: 15px; font-weight: 500; color: var(--ink); }
.detail-value a { color: var(--primary); font-weight: 600; }
.detail-value p { line-height: 1.7; white-space: pre-wrap; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; margin-left: 8px; border-radius: 4px; border: none; background: var(--paper); color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.15s ease; }
.copy-btn:hover { background: var(--border); color: var(--ink); }
.copy-btn.copied { background: var(--green-light); color: var(--green); }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 14px 20px; background: var(--ink); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; z-index: 1000; animation: slideUp 0.3s ease; }
.toast.success { background: var(--green); }
.toast.error { background: var(--primary); }
.toast .icon { width: 18px; height: 18px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Loading */
.loading-state { padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--muted); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* Login Page */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0f1419 0%, #1a1d23 50%, #2a1015 100%); padding: 24px; }
.login-card { width: min(420px, 100%); background: var(--white); border-radius: var(--radius-lg); padding: 40px; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; margin-bottom: 32px; }
.login-logo { height: 60px; width: auto; }
.login-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.login-subtitle { color: var(--muted); margin-bottom: 28px; }
.login-form label { display: block; margin-bottom: 20px; }
.login-form label span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--ink); }
.login-form input { width: 100%; height: 48px; padding: 0 16px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 15px; transition: all 0.15s ease; }
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-form .btn { width: 100%; height: 48px; font-size: 15px; }
.login-error { color: var(--primary); font-size: 13px; font-weight: 500; margin-top: 16px; text-align: center; }

/* Responsive */
@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { grid-template-columns: 1fr; }
  .list-panel { height: auto; max-height: 45vh; }
  .detail-panel { height: auto; min-height: 55vh; }
}

@media (max-width: 600px) {
  .topbar { padding: 0 16px; }
  .topbar-title { font-size: 16px; }
  .detail-content { padding: 16px; }
  .detail-header { padding: 20px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-actions { flex-direction: column; }
  .action-btn { justify-content: center; }
}
