:root {
  color-scheme: light;
  --font-sans: Inter, "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, system-ui, sans-serif;
  --bg: #eef3f6;
  --bg-elevated: #f7f9fb;
  --surface: #ffffff;
  --surface-strong: #fbfcfd;
  --surface-subtle: #f4f7f9;
  --sidebar: rgba(248, 251, 252, 0.92);
  --topbar: rgba(247, 250, 252, 0.86);
  --text: #17212b;
  --text-strong: #0b1520;
  --muted: #687586;
  --muted-weak: #8b97a6;
  --line: rgba(106, 122, 140, 0.18);
  --line-strong: rgba(74, 91, 108, 0.26);
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #e8f0ff;
  --accent-soft-2: #f0f6ff;
  --cyan: #0891b2;
  --green: #15803d;
  --green-soft: #e8f7ef;
  --violet: #6d5bd0;
  --amber: #b7791f;
  --amber-soft: #fff6e3;
  --danger: #c24141;
  --danger-soft: #fff0f0;
  --ok: #15803d;
  --radius: 8px;
  --radius-sm: 6px;
  --control-h: 38px;
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.05), 0 12px 34px rgba(15, 23, 42, 0.06);
  --shadow-pop: 0 22px 70px rgba(15, 23, 42, 0.18);
  --focus: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111820;
  --bg-elevated: #151f2a;
  --surface: #182330;
  --surface-strong: #1d2937;
  --surface-subtle: #14202b;
  --sidebar: rgba(18, 27, 37, 0.94);
  --topbar: rgba(18, 27, 37, 0.86);
  --text: #dce6ef;
  --text-strong: #f5f8fb;
  --muted: #93a1b2;
  --muted-weak: #768597;
  --line: rgba(151, 166, 184, 0.16);
  --line-strong: rgba(176, 190, 207, 0.24);
  --accent: #70a7ff;
  --accent-strong: #9cc2ff;
  --accent-soft: rgba(67, 125, 214, 0.18);
  --accent-soft-2: rgba(67, 125, 214, 0.12);
  --green-soft: rgba(21, 128, 61, 0.16);
  --amber-soft: rgba(183, 121, 31, 0.18);
  --danger-soft: rgba(194, 65, 65, 0.18);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.22), 0 18px 42px rgba(0, 0, 0, 0.24);
  --shadow-pop: 0 22px 76px rgba(0, 0, 0, 0.42);
  --focus: 0 0 0 3px rgba(112, 167, 255, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 4%, rgba(37, 99, 235, 0.08), transparent 26rem),
    linear-gradient(180deg, var(--bg-elevated), var(--bg) 38rem);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

::selection {
  background: rgba(37, 99, 235, 0.18);
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-panel {
  width: min(460px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-pop);
  backdrop-filter: blur(22px);
}

[data-theme="dark"] .login-panel {
  background: rgba(24, 35, 48, 0.82);
}

.install-panel {
  width: min(780px, 100%);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: linear-gradient(145deg, #1d4ed8, #0f766e);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22);
  color: #ffffff;
  font-weight: 800;
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  font-size: 12px;
}

.login-panel h1 {
  margin: 22px 0 8px;
  color: var(--text-strong);
  font-size: 27px;
  line-height: 1.18;
}

.login-subtitle {
  margin: 0 0 26px;
  color: var(--muted);
  line-height: 1.7;
}

.login-form,
.stacked-form {
  display: grid;
  gap: 15px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-weak);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.65;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.check-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
  color: var(--text);
  font-weight: 600;
}

.check-row input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

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

.segmented .check-row {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}

.segmented .check-row:has(input:checked) {
  border-color: rgba(37, 99, 235, 0.35);
  background: var(--accent-soft-2);
  color: var(--accent-strong);
}

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

.install-grid .wide {
  grid-column: 1 / -1;
}

.primary-action,
.secondary-action,
.ghost-action,
.text-action,
.icon-button,
.mini-button {
  min-height: var(--control-h);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 0 14px;
  white-space: nowrap;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.primary-action {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  font-weight: 750;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.primary-action:active,
.secondary-action:active,
.ghost-action:active,
.mini-button:active {
  transform: translateY(0);
}

.primary-action.compact {
  min-width: 84px;
}

.secondary-action {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.secondary-action:hover {
  background: var(--surface-subtle);
  border-color: var(--line-strong);
}

.ghost-action {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.ghost-action:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.ghost-action.danger,
.mini-button.danger {
  color: var(--danger);
}

.ghost-action.danger:hover,
.mini-button.danger:hover {
  border-color: rgba(194, 65, 65, 0.26);
  background: var(--danger-soft);
}

.text-action {
  min-height: 32px;
  padding: 0 2px;
  color: var(--accent-strong);
  background: transparent;
  border: 0;
  font-weight: 750;
}

.text-action:hover {
  color: var(--accent);
}

.icon-button {
  width: 36px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}

.form-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: var(--ok);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  backdrop-filter: blur(20px);
}

.sidebar-brand {
  display: flex;
  gap: 11px;
  align-items: center;
  min-width: 0;
  padding: 2px 6px 18px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand strong {
  display: block;
  color: var(--text-strong);
  font-size: 15px;
  line-height: 1.25;
}

.sidebar-brand span {
  display: block;
  max-width: 160px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-list {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  overflow-y: auto;
  padding-right: 4px;
}

.nav-list::before {
  content: "Workspace";
  padding: 0 11px 7px;
  color: var(--muted-weak);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-list::-webkit-scrollbar,
.workspace::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.nav-list::-webkit-scrollbar-thumb,
.workspace::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(109, 124, 142, 0.34);
  background-clip: content-box;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 700;
}

.nav-item::before {
  width: 22px;
  height: 22px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.nav-item[data-view="dashboard"]::before { content: "OV"; }
.nav-item[data-view="themes"]::before { content: "TH"; }
.nav-item[data-view="daily"]::before { content: "DY"; }
.nav-item[data-view="records"]::before { content: "RV"; }
.nav-item[data-view="users"]::before { content: "US"; }
.nav-item[data-view="admins"]::before { content: "AD"; }
.nav-item[data-view="userLogs"]::before { content: "UL"; }
.nav-item[data-view="logs"]::before { content: "LG"; }
.nav-item[data-view="settings"]::before { content: "ST"; }

.nav-item:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.nav-item.active {
  border-color: rgba(37, 99, 235, 0.22);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.nav-item.active::after {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.nav-item.active::before {
  border-color: rgba(37, 99, 235, 0.28);
  background: var(--surface);
  color: var(--accent-strong);
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.workspace {
  min-width: 0;
  padding: 22px 24px 32px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 9;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 68px;
  margin: -22px -24px 22px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(20px);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 23px;
  line-height: 1.25;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.topbar-search {
  position: relative;
  width: clamp(210px, 24vw, 340px);
}

.topbar-search::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 13px;
  height: 13px;
  border: 2px solid var(--muted-weak);
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.topbar-search::after {
  content: "";
  position: absolute;
  left: 24px;
  top: 23px;
  width: 7px;
  height: 2px;
  border-radius: 99px;
  background: var(--muted-weak);
  transform: rotate(45deg);
  pointer-events: none;
}

.topbar-search input {
  min-height: 36px;
  padding-left: 34px;
  background: var(--surface);
}

.notification-button {
  position: relative;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.notification-button::before {
  content: "";
  width: 13px;
  height: 15px;
  border: 1.8px solid currentColor;
  border-radius: 8px 8px 5px 5px;
  border-bottom-width: 2.5px;
}

.notification-button::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 8px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--danger);
}

.admin-chip {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 9px 4px 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.admin-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: linear-gradient(145deg, var(--violet), var(--cyan));
  color: #ffffff;
  font-size: 11px;
  font-weight: 850;
}

.admin-chip strong,
.admin-chip span {
  display: block;
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-chip strong {
  color: var(--text-strong);
  font-size: 12px;
  line-height: 1.2;
}

.admin-chip span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.view {
  display: none;
}

.active-view {
  display: grid;
  gap: 16px;
}

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

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric-card {
  position: relative;
  min-height: 116px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  overflow: hidden;
  padding: 18px;
}

.metric-card::before {
  content: "";
  width: 36px;
  height: 36px;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E") center / 18px 18px no-repeat,
    linear-gradient(145deg, var(--accent-soft), var(--surface));
}

.metric-card::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 17px;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-card strong {
  color: var(--text-strong);
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.metric-card:nth-child(2)::before {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2315803d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='M8 14h.01'/%3E%3Cpath d='M12 14h.01'/%3E%3Cpath d='M16 14h.01'/%3E%3C/svg%3E") center / 18px 18px no-repeat,
    linear-gradient(145deg, var(--green-soft), var(--surface));
}

.metric-card:nth-child(3)::before {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23b7791f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-4l-3 9L9 3l-3 9H2'/%3E%3C/svg%3E") center / 18px 18px no-repeat,
    linear-gradient(145deg, var(--amber-soft), var(--surface));
}

.metric-card:nth-child(4)::before {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236d5bd0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12h4l3 8 4-16 3 8h4'/%3E%3Cpath d='M18 19h3'/%3E%3Cpath d='M19.5 17.5v3'/%3E%3C/svg%3E") center / 18px 18px no-repeat,
    linear-gradient(145deg, rgba(109, 91, 208, 0.14), var(--surface));
}

.content-grid {
  display: grid;
  gap: 16px;
}

.two-columns {
  grid-template-columns: minmax(0, 1.22fr) minmax(320px, 0.78fr);
}

.panel {
  padding: 16px;
}

.panel-heading,
.form-actions,
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 15px;
  line-height: 1.35;
}

.bar-chart {
  display: grid;
  gap: 10px;
  min-height: 226px;
  padding-top: 2px;
}

.bar-row {
  display: grid;
  grid-template-columns: 78px minmax(120px, 1fr) 48px;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.bar-row span {
  display: grid;
  gap: 1px;
}

.bar-row span strong,
.bar-row > strong {
  color: var(--text);
  font-size: 12px;
}

.bar-row span small {
  color: var(--muted-weak);
  font-size: 11px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-subtle);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
}

.summary-box {
  display: grid;
  gap: 12px;
  min-height: 160px;
  align-content: start;
}

.theme-hero-card {
  position: relative;
  display: grid;
  gap: 14px;
  min-height: 188px;
  align-content: start;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, var(--accent-soft-2), transparent 58%),
    var(--surface-strong);
}

.theme-hero-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cyan), var(--green));
}

.theme-hero-card .summary-title {
  max-width: 720px;
  padding-top: 2px;
  font-size: 21px;
}

.theme-hero-card .summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.theme-meta-item {
  min-width: 0;
  display: grid;
  gap: 3px;
  min-height: 54px;
  align-content: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.62);
}

[data-theme="dark"] .theme-meta-item {
  background: rgba(255, 255, 255, 0.035);
}

.theme-meta-item small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.theme-meta-item strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-meta-item.mono strong {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
}

.theme-meta-item.auto {
  border-color: rgba(37, 99, 235, 0.2);
  background: var(--accent-soft-2);
}

.theme-meta-item.manual {
  border-color: rgba(21, 128, 61, 0.2);
  background: var(--green-soft);
}

.theme-meta-item.range {
  border-color: rgba(109, 91, 208, 0.22);
  background: rgba(109, 91, 208, 0.1);
}

.theme-empty-state {
  min-height: 150px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
  text-align: center;
}

[data-theme="dark"] .theme-empty-state {
  background: rgba(255, 255, 255, 0.025);
}

.theme-empty-state strong {
  color: var(--text-strong);
  font-size: 14px;
}

.theme-empty-state span {
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.theme-meta-pill {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 12px;
}

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

.summary-title {
  margin: 0;
  color: var(--text-strong);
  font-size: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.summary-meta,
.muted {
  color: var(--muted);
}

.summary-content {
  margin: 0;
  color: var(--text);
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1.15fr) minmax(150px, 0.75fr) minmax(124px, 0.5fr) auto auto;
  align-items: end;
  gap: 12px;
}

.range-toolbar,
.users-toolbar {
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
}

.users-toolbar {
  grid-template-columns: minmax(260px, 1fr) auto auto;
  margin-bottom: 14px;
}

.user-logs-toolbar {
  grid-template-columns: minmax(140px, 0.45fr) minmax(180px, 0.75fr) minmax(240px, 1fr) auto auto;
  margin-bottom: 14px;
}

.user-log-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.log-data-cell {
  max-width: 460px;
}

.log-data-cell strong {
  white-space: normal;
}

.batch-panel {
  display: grid;
  gap: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

td {
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 0.16s ease;
}

tbody tr:hover {
  background: var(--accent-soft-2);
}

.cell-title {
  display: grid;
  gap: 4px;
  max-width: 380px;
  min-width: 0;
}

.cell-title strong,
.cell-title span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-title strong {
  color: var(--text-strong);
  line-height: 1.35;
}

.cell-title span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(21, 128, 61, 0.18);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.badge.warning {
  border-color: rgba(183, 121, 31, 0.2);
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.danger {
  border-color: rgba(194, 65, 65, 0.2);
  background: var(--danger-soft);
  color: var(--danger);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mini-button {
  min-height: 30px;
  padding: 0 9px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.mini-button:hover {
  background: var(--surface-subtle);
  border-color: var(--line-strong);
}

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

.pagination span {
  min-width: 120px;
  text-align: center;
}

.mini-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
}

.mini-metric {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
}

.mini-metric strong {
  color: var(--text-strong);
}

.record-thumb-button {
  position: relative;
  width: 84px;
  height: 62px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.record-thumb-button:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.44);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.record-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.record-thumb-button span {
  display: none;
  color: var(--muted);
  font-size: 12px;
}

.record-thumb-button.no-image img {
  display: none;
}

.record-thumb-button.no-image span {
  display: inline;
}

.review-actions {
  display: grid;
  gap: 8px;
  width: 146px;
}

.review-select-wrap {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.review-select,
.review-detail-select select {
  min-height: 34px;
  padding: 6px 9px;
}

.avatar {
  width: 36px;
  height: 36px;
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--accent-soft);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 13, 20, 0.48);
  backdrop-filter: blur(6px);
  animation: fade-in 0.16s ease;
}

.modal {
  width: min(1040px, 100%);
  max-height: min(860px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  animation: modal-in 0.18s ease;
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
}

.modal-heading h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 17px;
}

.modal-body {
  max-height: calc(100vh - 142px);
  overflow: auto;
  padding: 18px;
}

.modal-body img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.review-detail {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(300px, 0.95fr);
  gap: 18px;
}

.review-detail-media {
  position: relative;
  min-height: 420px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.review-detail-image {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border: 0 !important;
  border-radius: 0 !important;
}

.review-detail-empty {
  display: none;
  color: var(--muted);
}

.review-detail-media.no-image .review-detail-image {
  display: none;
}

.review-detail-media.no-image .review-detail-empty {
  display: block;
}

.review-detail-main {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
  padding: 2px 2px 2px 0;
}

.review-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.review-detail-header h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 23px;
  line-height: 1.28;
}

.review-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-detail-meta span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
}

.review-detail-content {
  display: grid;
  gap: 8px;
}

.review-detail-content strong {
  color: var(--text-strong);
  font-size: 13px;
}

.review-detail-content p {
  min-height: 130px;
  margin: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.review-detail-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.edit-form {
  display: grid;
  gap: 14px;
}

.settings-form {
  max-width: 680px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-height: 80px;
}

.setting-row strong,
.setting-row span {
  display: block;
}

.info-list {
  display: grid;
  gap: 0;
}

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

.info-list div:last-child {
  border-bottom: 0;
}

.info-list span {
  color: var(--muted);
}

.info-list strong {
  text-align: right;
  overflow-wrap: anywhere;
}

.connection-result {
  min-height: 48px;
}

.connection-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.connection-card.ok {
  border-color: rgba(21, 128, 61, 0.34);
  background: var(--green-soft);
}

.connection-card.danger {
  border-color: rgba(194, 65, 65, 0.34);
  background: var(--danger-soft);
}

.connection-card span,
.connection-card small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-pop);
  animation: toast-in 0.18s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: minmax(220px, auto) 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
  }

  .sidebar-brand {
    padding: 0;
    border-bottom: 0;
  }

  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(110px, max-content);
    margin-top: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0;
  }

  .nav-list::before {
    display: none;
  }

  .nav-item.active::after {
    left: 12px;
    top: auto;
    right: 12px;
    bottom: -2px;
    width: auto;
    height: 2px;
  }

  .sidebar-footer {
    display: flex;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .metric-grid,
  .two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .daily-quick-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .range-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .workspace {
    padding: 18px 16px 26px;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    margin: -18px -16px 18px;
    padding: 14px 16px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
  }

  .topbar-search {
    width: auto;
    min-width: 0;
  }

  .admin-chip {
    max-width: 130px;
  }

  .metric-grid,
  .two-columns,
  .review-detail,
  .theme-meta-grid,
  .toolbar,
  .range-toolbar,
  .users-toolbar,
  .user-logs-toolbar,
  .install-grid,
  .segmented,
  .daily-quick-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 102px;
  }

  .review-detail-media {
    min-height: 300px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  .login-view {
    padding: 18px;
  }

  .login-panel {
    padding: 22px;
  }

  .sidebar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .nav-list {
    grid-auto-columns: 126px;
  }

  .sidebar-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .topbar-actions {
    grid-template-columns: 1fr auto auto;
  }

  .topbar-actions > .secondary-action {
    grid-column: 1 / -1;
  }

  .admin-chip {
    display: none;
  }

  .panel {
    padding: 14px;
  }

  .panel-heading,
  .form-actions,
  .pagination,
  .review-detail-footer,
  .setting-row {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions,
  .pagination {
    display: grid;
    grid-template-columns: 1fr;
  }

  .review-detail-footer {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-body {
    padding: 14px;
  }
}
