@import url('/assets/fonts/fonts.css');
:root {
  --bg-deep: #07070a;
  --bg-surface: #0c0c12;
  --bg-elevated: #111118;
  --bg-card: #16161e;
  --bg-input: #0e0e14;
  --border: #1e1e30;
  --border-light: #2a2a40;
  --border-accent: #3b82f6;
  --text-primary: #e8e8f0;
  --text-secondary: #7a7a95;
  --text-muted: #4a4a60;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-dim: rgba(59, 130, 246, 0.08);
  --accent-glow: rgba(59, 130, 246, 0.2);
  --gold: #f0b429;
  --green: #22c55e;
  --red: #ef4444;
  --sidebar-width: 250px;
  --header-height: 60px;
}

* { margin:0; padding:0; box-sizing:border-box; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  font-size: 14px;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== LOGIN ========== */
#login-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-deep);
}
#login-screen.hidden { display: none; }

.login-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px; opacity: 0.12;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black 30%, transparent 70%);
}

.login-glow {
  position: absolute; width: 500px; height: 500px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none;
}

.login-card {
  position: relative; width: 400px; padding: 40px 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { height: 32px; }

.login-title {
  text-align: center; font-size: 20px; font-weight: 700;
  letter-spacing: -0.3px; margin-bottom: 4px;
}
.login-subtitle {
  text-align: center; color: var(--text-secondary);
  font-size: 13px; margin-bottom: 28px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 6px;
}

.form-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 14px; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s; outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.form-input::placeholder { color: var(--text-muted); }

.form-options {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
}
.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.forgot-link { font-size: 13px; color: var(--accent); text-decoration: none; }
.forgot-link:hover { text-decoration: underline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 20px; border: none;
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s ease;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-primary {
  width: 100%; background: var(--accent); color: white;
  box-shadow: 0 2px 10px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 15px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red); color: white; }

.login-error { color: var(--red); font-size: 13px; text-align: center; margin-top: 12px; display: none; }
.login-footer { text-align: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
.login-footer a { color: var(--accent); text-decoration: none; font-weight: 600; }
.login-footer a:hover { text-decoration: underline; }

/* ========== APP ========== */
#app-screen { display: none; height: 100vh; width: 100vw; }
#app-screen.active { display: flex; }

.app-bg {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px; opacity: 0.06;
  pointer-events: none; z-index: 0;
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-width); min-width: var(--sidebar-width);
  background: var(--bg-surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 10; height: 100vh;
}

.sidebar-header {
  padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-header img { height: 20px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px; }

.nav-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  padding: 16px 12px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin: 1px 0;
  color: var(--text-secondary); text-decoration: none;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all 0.12s ease; position: relative;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-dim); color: var(--accent);
  border-left-color: var(--accent);
}
.nav-item .material-icons-round { font-size: 18px; width: 22px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--red); color: white;
  font-size: 10px; font-weight: 700; padding: 1px 5px; min-width: 16px; text-align: center;
}

.sidebar-footer { padding: 8px; border-top: 1px solid var(--border); }

/* ========== MAIN ========== */
.main-area { flex: 1; display: flex; flex-direction: column; z-index: 1; overflow: hidden; }

/* ========== TOPBAR ========== */
.topbar {
  height: var(--header-height); min-height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: rgba(12, 12, 18, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 5;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-left h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.menu-toggle { display: none; cursor: pointer; color: var(--text-secondary); background: none; border: none; font-size: 22px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.notif-btn {
  position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
  border: 1px solid var(--border); background: var(--bg-elevated);
}
.notif-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.notif-btn .notif-dot {
  position: absolute; top: 6px; right: 6px; width: 6px; height: 6px;
  background: var(--red); display: none; border: 1px solid var(--bg-surface);
}
.notif-btn .notif-dot.active { display: block; }

.user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.15s; color: var(--text-primary);
}
.user-btn:hover { border-color: var(--border-light); }

.user-avatar {
  width: 28px; height: 28px;
  background: var(--accent); display: flex;
  align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info-text { text-align: left; }
.user-name { font-size: 12px; font-weight: 600; line-height: 1.2; }
.user-role { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }

/* ========== VIEW ========== */
.view-container { flex: 1; overflow-y: auto; padding: 24px; z-index: 1; }

/* ========== NOTIF DROPDOWN ========== */
.notif-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 340px; max-height: 420px;
  background: var(--bg-surface); border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  display: none; flex-direction: column; z-index: 100; overflow: hidden;
}
.notif-dropdown.active { display: flex; }

.notif-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 700;
}
.notif-header a { font-size: 11px; color: var(--accent); cursor: pointer; }
.notif-header a:hover { text-decoration: underline; }
.notif-list { overflow-y: auto; flex: 1; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: default; }
.notif-item:hover { background: var(--bg-elevated); }
.notif-item.unread { border-left: 2px solid var(--accent); background: var(--accent-dim); }
.notif-item-title { font-size: 12px; font-weight: 600; margin-bottom: 2px; color: var(--text-primary); }
.notif-item-msg { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }
.notif-item-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ========== USER DROPDOWN ========== */
.user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; width: 200px;
  background: var(--bg-surface); border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  display: none; flex-direction: column; z-index: 100; overflow: hidden;
}
.user-dropdown.active { display: flex; }
.user-dropdown-item {
  padding: 10px 14px; font-size: 13px; color: var(--text-secondary);
  cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.12s;
}
.user-dropdown-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.user-dropdown-item .material-icons-round { font-size: 16px; }
.user-dropdown-item.logout { color: var(--red); border-top: 1px solid var(--border); }

/* ========== PAGE ========== */
.page-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;
}
.page-header h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.page-header p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; }

/* ========== STATS ========== */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  padding: 16px; position: relative; overflow: hidden; transition: all 0.15s;
}
.stat-card:hover { border-color: var(--border-light); }
.stat-card .stat-top-border { height: 2px; margin: -16px -16px 12px; }
.stat-card.blue .stat-top-border { background: var(--accent); }
.stat-card.gold .stat-top-border { background: var(--gold); }
.stat-card.green .stat-top-border { background: var(--green); }
.stat-card.purple .stat-top-border { background: #8b5cf6; }

.stat-icon {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.stat-card.blue .stat-icon { background: var(--accent-dim); color: var(--accent); }
.stat-card.gold .stat-icon { background: rgba(240,180,41,0.12); color: var(--gold); }
.stat-card.green .stat-icon { background: rgba(34,197,94,0.12); color: var(--green); }
.stat-card.purple .stat-icon { background: rgba(139,92,246,0.12); color: #8b5cf6; }
.stat-icon .material-icons-round { font-size: 16px; }

.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.stat-label { font-size: 11px; color: var(--text-secondary); font-weight: 500; margin-top: 2px; }

/* ========== CARDS ========== */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.card {
  background: var(--bg-surface); border: 1px solid var(--border); overflow: hidden;
}
.card-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.card-header a { font-size: 11px; color: var(--accent); cursor: pointer; }
.card-header a:hover { text-decoration: underline; }
.card-body { padding: 12px 16px; }
.card.full { grid-column: 1 / -1; }
.card + .card { margin-top: 12px; }

/* ========== ACTIVITY ========== */
.activity-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 6px; height: 6px; margin-top: 5px; flex-shrink: 0;
}
.activity-dot.blue { background: var(--accent); }
.activity-dot.gold { background: var(--gold); }
.activity-dot.green { background: var(--green); }
.activity-dot.red { background: var(--red); }

.activity-text { font-size: 12px; line-height: 1.4; flex: 1; }
.activity-text strong { font-weight: 600; color: var(--text-primary); }
.activity-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

/* ========== TABLE ========== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th {
  text-align: left; padding: 10px 12px; font-size: 10px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
table tr:hover td { background: var(--bg-elevated); }
table tr:last-child td { border-bottom: none; }

/* ========== BADGES ========== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.3px;
  border: 1px solid transparent;
}
.badge-blue { border-color: var(--accent); color: var(--accent); }
.badge-blue { background: var(--accent-dim); border-color: transparent; color: var(--accent); }
.badge-green { background: rgba(34,197,94,0.12); color: var(--green); }
.badge-gold { background: rgba(240,180,41,0.12); color: var(--gold); }
.badge-red { background: rgba(239,68,68,0.12); color: var(--red); }
.badge-gray { background: var(--bg-elevated); color: var(--text-muted); }

/* ========== EMPTY ========== */
.empty-state { text-align: center; padding: 40px 16px; }
.empty-state .material-icons-round { font-size: 40px; color: var(--text-muted); margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; margin-bottom: 4px; color: var(--text-secondary); }
.empty-state p { font-size: 13px; color: var(--text-muted); max-width: 320px; margin: 0 auto 16px; }

/* ========== MODAL ========== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  backdrop-filter: blur(3px); z-index: 1000;
  display: none; align-items: center; justify-content: center;
}
.modal-backdrop.active { display: flex; }

.modal {
  width: 500px; max-width: 90vw; max-height: 80vh;
  background: var(--bg-surface); border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 4px; }
.modal-close:hover { color: var(--text-primary); background: var(--bg-elevated); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ========== FORM ========== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
textarea.form-input { resize: vertical; min-height: 90px; font-family: inherit; }
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%237a7a95' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

/* ========== SERVICES ========== */
.services-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px;
}
.service-card { background: var(--bg-card); border: 1px solid var(--border); padding: 16px; transition: all 0.15s; }
.service-card:hover { border-color: var(--border-light); }
.service-card .service-icon { width: 36px; height: 36px; background: var(--accent-dim); display: flex; align-items: center; justify-content: center; color: var(--accent); margin-bottom: 12px; }
.service-card .service-icon .material-icons-round { font-size: 16px; }
.service-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.service-card p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 12px; }
.service-card .service-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--border); }
.service-card .service-price { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; }
.service-card .service-price small { font-size: 10px; font-weight: 500; color: var(--text-muted); }

/* ========== TICKETS ========== */
.ticket-item { background: var(--bg-card); border: 1px solid var(--border); padding: 14px; margin-bottom: 8px; cursor: pointer; transition: all 0.12s; }
.ticket-item:hover { border-color: var(--border-light); background: var(--bg-elevated); }
.ticket-item .ticket-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.ticket-item .ticket-title { font-size: 13px; font-weight: 600; }
.ticket-item .ticket-date { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.ticket-item .ticket-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticket-item .ticket-footer { display: flex; gap: 6px; margin-top: 8px; }

/* ========== LOADING ========== */
.loading-state { display: flex; align-items: center; justify-content: center; padding: 48px; }
.spinner { width: 28px; height: 28px; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== TOAST ========== */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column-reverse; gap: 6px; }
.toast {
  padding: 10px 16px; font-size: 13px; font-weight: 500; color: white;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
  display: flex; align-items: center; gap: 8px; backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
}
.toast.success { background: rgba(34,197,94,0.92); }
.toast.error { background: rgba(239,68,68,0.92); }
.toast.info { background: rgba(59,130,246,0.92); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 992px) {
  .sidebar { position: fixed; left: -260px; transition: left 0.25s ease; z-index: 100; }
  .sidebar.open { left: 0; box-shadow: 8px 0 32px rgba(0,0,0,0.5); }
  .menu-toggle { display: block; }
  .view-container { padding: 16px; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { width: 100%; margin: 12px; padding: 28px 20px; }
  .form-row { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; }
  .view-container { padding: 12px; }
  .user-info-text { display: none; }
  .notif-dropdown { width: calc(100vw - 24px); right: -50px; }
}
