:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --card-soft: #f9fafb;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #111827;
  --primary-2: #1f2937;
  --blue: #2563eb;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  padding: 16px;
}

.page {
  max-width: 1480px;
  margin: 0 auto;
}

.page.narrow {
  max-width: 760px;
}

.page.auth {
  max-width: 380px;
}

.topbar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(10px);
}

.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand.small {
  font-size: 28px;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

.officer-topbar {
  position: relative;
  padding: 14px 16px;
}

.officer-topbar-row {
  align-items: flex-start;
}

.topbar-left {
  min-width: 0;
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.officer-subtitle {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.menu-toggle-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.menu-toggle-btn:active {
  transform: translateY(1px);
}

.officer-menu {
  display: none;
  position: absolute;
  top: calc(100% - 2px);
  right: 18px;
  width: 240px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.14);
  padding: 8px;
  z-index: 1200;
}

.officer-menu.open {
  display: block;
}

.officer-menu-item {
  width: 100%;
  appearance: none;
  border: 0;
  background: white;
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  transition: background 0.15s ease;
}

.officer-menu-item:hover {
  background: #f9fafb;
}

.officer-menu-item.danger {
  color: var(--danger);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: #f9fafb;
  border: 1px solid var(--border);
  color: var(--text);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tab-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  padding: 11px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  background: #f9fafb;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.16);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.section,
.card,
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
  padding: 16px;
  margin-bottom: 14px;
}

.auth-card {
  margin-top: 10vh;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin: 0;
}

.section-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.section-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 0 0;
}

.subtle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.btn,
.action-btn,
.submit-btn,
.icon-btn {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover,
.action-btn:hover,
.submit-btn:hover,
.icon-btn:hover {
  opacity: 0.96;
}

.btn:active,
.action-btn:active,
.submit-btn:active,
.icon-btn:active {
  transform: translateY(1px);
}

.btn.dark,
.action-btn.dark,
.icon-btn.dark {
  background: var(--primary);
  color: white;
}

.btn.soft,
.action-btn.soft {
  background: #eef2ff;
  color: #1d4ed8;
  border: 1px solid #dbeafe;
}

.btn.success,
.action-btn.success,
.submit-btn {
  background: var(--success);
  color: white;
}

.btn.warning,
.action-btn.warning {
  background: var(--warning);
  color: white;
}

.btn.danger,
.action-btn.danger {
  background: var(--danger);
  color: white;
}

.btn.ghost,
.action-btn.ghost,
.icon-btn {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
}

.action-row,
.top-actions,
.org-actions,
.user-actions,
.entity-actions,
.ticket-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.action-btn {
  min-height: 48px;
}

.form-grid,
.tickets-grid,
.org-grid,
.drawer-list {
  display: grid;
  gap: 12px;
}

.form-grid-2,
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 14px;
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: var(--text);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-card {
  background: linear-gradient(180deg, #ffffff, #fafafa);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  font-weight: 700;
}

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.chart-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  height: 320px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.03);
}

.chart-box h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}

.chart-box canvas {
  width: 100% !important;
  height: 250px !important;
}

.performance-grid,
.vip-grid,
.users-grid,
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.performance-card,
.vip-card,
.user-card,
.entity-card,
.live-card,
.file-status,
.meta-item,
.org-card,
.notif-item,
.ticket-card,
.list-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: white;
  padding: 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.03);
}

.performance-card h4,
.entity-card strong,
.user-card strong,
.org-main strong {
  margin: 0 0 8px 0;
  display: block;
  font-size: 17px;
}

.performance-line,
.user-sub,
.entity-sub,
.vip-line,
.org-sub {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.performance-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.performance-line:last-child {
  border-bottom: none;
}

.performance-line strong {
  color: var(--text);
}

.ticket-card {
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.ticket-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: linear-gradient(180deg, #ffffff, #fbfbfb);
}

.ticket-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ticket-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.ticket-sub {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
}

.ticket-preview {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  background: #ffffff;
}

.ticket-preview-left {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 14px;
  flex: 1;
  min-width: 0;
}

.preview-label,
.detail-label,
.meta-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  font-weight: 700;
}

.preview-value,
.detail-value,
.meta-value,
.row-title {
  font-size: 14px;
  font-weight: 700;
  word-break: break-word;
  color: var(--text);
}

.ticket-details {
  display: none;
  border-top: 1px solid var(--border);
  padding: 16px;
}

.ticket-details.open {
  display: block;
}

.ticket-body {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.detail-grid,
.file-status-grid,
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-box {
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
}

.ticket-images {
  display: grid;
  gap: 10px;
}

.image-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: #fcfcfd;
}

.image-card strong {
  display: block;
  margin-bottom: 8px;
}

.image-card img {
  width: 100%;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.history-box {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: #fcfcfd;
}

.history-box h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.history-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.history-row:last-child {
  border-bottom: none;
}

.notice {
  display: none;
  margin-top: 10px;
  padding: 12px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  border: 1px solid transparent;
  font-weight: 500;
}

.notice.info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.notice.success {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.notice.warning {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.notice.danger {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.status-box {
  margin-top: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.6;
  min-height: 52px;
  white-space: pre-wrap;
}

.submit-wrap {
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  z-index: 20;
}

.submit-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 12px;
}

.submit-btn {
  width: 100%;
  min-height: 56px;
  font-size: 17px;
  font-weight: 800;
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(22, 163, 74, 0.18);
}

.hidden-file {
  display: none;
}

.optional-tools {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.optional-tools summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  list-style: none;
}

.optional-tools summary::-webkit-details-marker {
  display: none;
}

.optional-tools summary::after {
  content: "Show";
  float: right;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.optional-tools[open] summary::after {
  content: "Hide";
}

.notifications-drawer {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 360px;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px);
  overflow: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 14px;
  z-index: 1000;
  display: none;
}

.notifications-drawer.open {
  display: block;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.drawer-title {
  font-size: 18px;
  font-weight: 800;
}

.notif-item.unread {
  background: #f8fbff;
  border-color: #bfdbfe;
}

.notif-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
}

.notif-message {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.notif-time {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.icon-btn {
  position: relative;
}

.notif-badge {
  position: static;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  flex-shrink: 0;
}

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 18px;
  margin: 0 auto;
  max-width: 460px;
  background: #111827;
  color: white;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.22);
  z-index: 1100;
  display: none;
}

.toast.show {
  display: block;
}

.toast-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
}

.toast-message {
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.5;
}

.link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.muted,
.row-sub {
  color: var(--muted);
}

.list-shell {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.list-head {
  background: linear-gradient(180deg, #fafafa, #f3f4f6);
}

.list-row {
  background: white;
  transition: background 0.15s ease, transform 0.08s ease;
}

.list-row:hover {
  background: #fcfcfd;
}

.row-actions .btn {
  min-width: 96px;
}

.pill {
  font-weight: 800;
}

.pill.dark {
  background: #e5e7eb;
  border-color: #d1d5db;
  color: #111827;
}

.pill.success,
.pill.warning {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.modal-card {
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.modal-title {
  letter-spacing: -0.03em;
}

#ticketMap {
  height: 560px;
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

@media (max-width: 1180px) {

  .kpi-grid,
  .filters-grid,
  .charts-grid,
  .ticket-preview-left,
  .ticket-body,
  .detail-grid,
  .form-grid-2,
  .grid-2,
  .file-status-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  #ticketMap {
    height: 420px;
  }
}

@media (max-width: 1100px) {
  .row-actions .btn {
    min-width: unset;
  }
}

@media (max-width: 980px) {
  .list-row {
    padding: 14px;
  }

  .row-actions .btn {
    min-width: unset;
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px;

  }

  .topbar,
  .section,
  .card,
  .auth-card {
    padding: 14px;
  }

  .brand {
    font-size: 26px;
  }

  .topbar-row,
  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }

  .officer-topbar {
    padding: 14px 16px;
  }

  .officer-topbar-row {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .topbar-left {
    flex: 1;
    min-width: 0;
  }

  .topbar-right {
    width: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
    align-self: flex-start;
  }

  .menu-toggle-btn {
    width: auto;
    padding: 10px 16px;
  }

  .officer-menu {
    right: 14px;
    left: 14px;
    width: auto;
    top: calc(100% - 4px);
  }

  .notifications-drawer {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
  }

  .submit-btn {
    min-height: 58px;
    font-size: 18px;
  }
}