/* ── Admin layout ──────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Live ticket notifications ─────────────────────────── */
.ticket-notification-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.ticket-notification {
  display: block;
  padding: 14px 16px;
  border: 1px solid rgba(37, 99, 235, .22);
  border-left: 4px solid var(--color-primary);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
  text-decoration: none;
  animation: ticketNoticeIn .22s ease;
}

.ticket-notification:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, .2);
}

.ticket-notification-kicker {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--color-primary);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.ticket-notification-title {
  margin-bottom: 4px;
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.35;
}

.ticket-notification-meta {
  color: var(--color-text-muted);
  font-size: .8rem;
  line-height: 1.45;
}

@keyframes ticketNoticeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: 248px;
  background: #181d4d;
  background-image:
    radial-gradient(circle at 100% 0%, rgba(0,255,189,.10), transparent 45%),
    linear-gradient(180deg, #2c3da7 0%, #181d4d 100%);
  color: #e4e4e0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  border-right: 1px solid #000;
}
.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo .app-name {
  font-size: 1.02rem;
  font-weight: 600;
  color: #f5f5f2;
  letter-spacing: -.015em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .app-name img { display: block; width: 168px; height: auto; }
.sidebar-logo .app-name:hover { text-decoration: none; }
.sidebar-logo .app-subtitle {
  font-size: .66rem;
  color: #7a7d84;
  margin-top: 4px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar-nav { padding: 14px 10px; flex: 1; }
.nav-section-label {
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #5a5d64;
  padding: 14px 12px 6px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: #a7a9ae;
  font-size: .855rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .1s, color .1s;
  margin-bottom: 1px;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,.04);
  color: #fff;
  text-decoration: none;
}
.nav-item.active {
  background: rgba(0,255,189,.12);
  color: #fff;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: #00ffbd;
  border-radius: 2px;
}
.nav-item svg { flex-shrink: 0; opacity: .65; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; color: #cfd9ff; }

.sidebar-footer {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f63c6, #1d4ed8);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 600; color: #fff; flex-shrink: 0;
  letter-spacing: -.01em;
}
.sidebar-user .user-name { font-size: .8rem; font-weight: 500; color: #e4e4e0; }
.sidebar-user .user-role { font-size: .66rem; color: #6b6e74; letter-spacing: .04em; text-transform: uppercase; margin-top: 1px; }

/* ── Main content ──────────────────────────────────────── */
.main-content {
  margin-left: 248px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-header {
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--color-border);
  padding: 0 28px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title {
  font-size: .92rem;
  font-weight: 600;
  letter-spacing: -.012em;
  color: var(--color-text);
}
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-user { font-size: .82rem; color: var(--color-text-muted); }
.inventory-alert-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid #f2c98a;
  border-radius: var(--radius);
  background: #fff7e6;
  color: #92400e;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
}
.inventory-alert-link:hover {
  background: #ffefd0;
  color: #7c2d12;
  text-decoration: none;
}
.inventory-alert-dot {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d97706;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
}

.content-area { padding: 28px 32px 48px; flex: 1; max-width: 1440px; width: 100%; }

/* ── Hamburger / overlay ───────────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--color-text);
}
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,.45);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ── Admin login ───────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #181d4d;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(0,255,189,.12), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(44,61,167,.35), transparent 45%);
  padding: 20px;
}
.login-box {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 38px 40px 32px;
  width: 100%;
  max-width: 400px;
  border: 1px solid rgba(0,0,0,.04);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo .app-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.login-logo-link {
  display: inline-flex;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--color-primary-dark);
}
.login-logo-link img { display: block; width: 180px; height: auto; }
.login-return { margin-top: 18px; text-align: center; font-size: .82rem; }
.login-logo .app-sub {
  font-size: .72rem;
  color: var(--color-text-muted);
  margin-top: 6px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 600;
}
.login-box h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--color-text);
  letter-spacing: -.01em;
}

/* ── Two column layout ─────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.inventory-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.inventory-page-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0 0 3px;
  color: var(--color-text);
}
.inventory-page-header p {
  margin: 0;
  font-size: .84rem;
  color: var(--color-text-muted);
}
.inventory-filters-panel {
  margin-bottom: 20px;
}
.inventory-filters-panel .inventory-filters {
  margin-bottom: 0;
}
.inventory-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.inventory-stock-badge {
  min-width: 44px;
  justify-content: center;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.compact-table th,
.compact-table td {
  padding: 8px 10px;
  font-size: .78rem;
}
.inventory-alert-card {
  border-color: #f2d9a0;
  background: #fffdf7;
}
.inventory-alert-list {
  display: grid;
  gap: 8px;
}
.inventory-alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #f2d9a0;
  border-radius: var(--radius);
  background: #fff;
}
.inventory-alert-stock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* ── Ticket timeline ───────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 2px; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--color-border);
  position: relative;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f63c6, #1d4ed8);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 600; color: #fff;
  flex-shrink: 0;
  letter-spacing: -.01em;
}
.timeline-avatar.client-avatar { background: linear-gradient(135deg, #9333ea, #6d28d9); }
.timeline-avatar.system-avatar { background: linear-gradient(135deg, #9ca3af, #6b7280); }

.timeline-content { flex: 1; min-width: 0; }
.timeline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.timeline-author { font-size: .86rem; font-weight: 600; color: var(--color-text); letter-spacing: -.005em; }
.timeline-time { font-size: .74rem; color: var(--color-text-muted); }
.timeline-internal {
  background: #fff8e1;
  border: 1px solid #f2d9a0;
  border-radius: var(--radius);
  padding: 12px 14px;
}
.timeline-internal .timeline-body { color: #7c3f05; }
.internal-badge {
  font-size: .64rem;
  background: #f2d9a0;
  color: #7c3f05;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.timeline-body {
  font-size: .88rem;
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--color-text-soft);
}

/* ── Filters bar ───────────────────────────────────────── */
.filters-bar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  box-shadow: var(--shadow-sm);
}
.filter-group { display: flex; flex-direction: column; gap: 5px; min-width: 140px; }
.filter-group label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.filter-group .form-control { padding: 7px 11px; font-size: .82rem; }

/* ── Chart ─────────────────────────────────────────────── */
.chart-container { position: relative; height: 230px; }

/* Ticket planning */
.work-timer {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  background: #f8fbff;
}
.work-timer.is-overdue {
  border-color: #fecaca;
  background: #fff7f7;
}
.work-timer-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.work-timer-label,
.work-timer-meta,
.work-session-row span {
  display: block;
  color: var(--color-text-muted);
  font-size: .74rem;
}
.work-timer-time {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 10px;
}
.work-timer-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
  margin-bottom: 8px;
}
.work-timer-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-success);
}
.work-timer.is-overdue .work-timer-bar span {
  background: var(--color-danger);
}
.work-session-list {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: 8px;
}
.work-session-title {
  color: var(--color-text-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.work-session-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.work-session-row.is-overdue {
  border-color: #fecaca;
  background: #fff7f7;
}
.work-assignee-list { display: grid; gap: 14px; }
.work-assignee-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
  display: grid;
  gap: 14px;
}
.work-assignee-card.is-overdue {
  border-color: #fecaca;
  background: #fff7f7;
}
.work-assignee-card.is-active {
  border-color: #86efac;
  background: #f0fdf4;
}
.work-assignee-head,
.work-status,
.work-live-panel,
.work-timer-actions,
.work-manual-form {
  display: flex;
  align-items: center;
  gap: 10px;
}
.work-assignee-head {
  justify-content: space-between;
}
.work-status {
  gap: 7px;
  white-space: nowrap;
}
.work-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 5px rgba(22,163,74,.12);
}
.work-live-panel {
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #f8fafc;
  border: 1px solid var(--color-border);
}
.work-live-panel.is-active {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #14532d;
}
.work-live-time {
  font-size: 1.2rem;
  letter-spacing: 0;
}
.work-timer-actions {
  justify-content: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.work-manual-form {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.work-hours-input {
  width: 100%;
  min-width: 0;
}
.assignee-check-list {
  display: grid;
  gap: 8px;
}
.assignee-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 500;
}
.assignee-check:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
}
.assignee-check.is-selected {
  border-color: #93c5fd;
  background: #eff6ff;
}
.assignee-check input {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* Schedule */
.schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.schedule-header h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  font-weight: 700;
}
.schedule-header p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: .875rem;
}
.schedule-month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.schedule-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: auto;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.schedule-weekday {
  padding: 10px;
  background: #f8fafc;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.schedule-weekday:nth-child(7n) {
  border-right: none;
}
.schedule-day {
  min-height: 150px;
  padding: 10px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}
.schedule-day:nth-child(7n) {
  border-right: none;
}
.schedule-day.is-empty {
  background: #f8fafc;
}
.schedule-day-number {
  color: var(--color-text-muted);
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.schedule-day-tickets {
  display: grid;
  gap: 7px;
}
.schedule-ticket {
  display: block;
  padding: 8px 9px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  background: #fff;
}
.schedule-ticket:hover {
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.schedule-ticket.priority-critical { border-left-color: var(--color-danger); }
.schedule-ticket.priority-high { border-left-color: #ea580c; }
.schedule-ticket.priority-medium { border-left-color: var(--color-warning); }
.schedule-ticket.priority-low { border-left-color: var(--color-success); }
.schedule-ticket span,
.schedule-ticket small,
.schedule-ticket em {
  display: block;
}
.schedule-ticket span {
  color: var(--color-primary);
  font-size: .68rem;
  font-weight: 700;
}
.schedule-ticket strong {
  display: block;
  margin: 2px 0;
  font-size: .78rem;
  line-height: 1.25;
}
.schedule-ticket small,
.schedule-ticket em {
  color: var(--color-text-muted);
  font-size: .68rem;
  font-style: normal;
  line-height: 1.35;
}
.schedule-undated {
  margin-bottom: 20px;
}

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,15,15,.52);
  backdrop-filter: blur(3px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 28px 30px;
  width: 100%;
  max-width: 480px;
  position: relative;
  border: 1px solid rgba(0,0,0,.04);
}
.modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: -.012em;
}
.modal > .modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .1s, color .1s;
}
.modal > .modal-close:hover { background: var(--color-bg); color: var(--color-text); }

/* ── Info list ─────────────────────────────────────────── */
.info-list { display: flex; flex-direction: column; gap: 11px; }
.info-item {
  display: flex;
  gap: 10px;
  font-size: .85rem;
  padding-bottom: 11px;
  border-bottom: 1px dashed var(--color-border);
}
.info-item:last-child { border-bottom: none; padding-bottom: 0; }
.info-label {
  color: var(--color-text-muted);
  font-weight: 500;
  min-width: 100px;
  flex-shrink: 0;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-top: 2px;
}
.info-value { color: var(--color-text); font-weight: 500; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .overlay.active { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .two-col { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .schedule-calendar { grid-template-columns: repeat(7, minmax(150px, 1fr)); }
  .work-manual-form { grid-template-columns: 1fr; }
  .work-timer-actions { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 600px) {
  .top-header { padding: 0 18px; }
  .content-area { padding: 20px 18px 40px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 16px 16px; }
  .stat-card .stat-number { font-size: 1.55rem; }
  .card { padding: 18px 18px; }
  .login-box { padding: 30px 24px; }
}
