/* Audionika style overrides based on the reference dashboard. */
:root {
  /* Design tokens imported from modern reference */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.92);

  --gradient-brand: linear-gradient(135deg, #0f67b3 0%, #1a8fcf 50%, #22b8cf 100%);
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));

  --primary-400: #3b82f6;
  --primary-500: #2563eb;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;

  --success-500: #10b981;
  --success-600: #059669;
  --warning-500: #f59e0b;
  --error-500: #ef4444;
  --info-500: #06b6d4;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;

  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  --shadow-glow: 0 0 0 4px rgba(37, 99, 235, 0.08);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Backwards-compatible aliases used across project */
  --primary: var(--primary-500);
  --primary-dark: var(--primary-700);
  --accent: var(--primary-600);
  --muted: var(--text-tertiary);
  --text: var(--text-primary);
  --line: rgba(37,99,235,0.06);
  --bg: var(--bg-primary);
  --bg-soft: #eef3f7;
  --panel-bg: var(--bg-secondary);
  --panel-bg-strong: var(--bg-glass);
  --panel-border: rgba(37,99,235,0.10);
  --card-bg: var(--bg-secondary);
  --card-bg-soft: rgba(37,99,235,0.04);
}

html { color-scheme: light; }

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, var(--bg), var(--bg-soft));
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

a { color: var(--primary); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-glass);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  border-bottom: 1px solid rgba(16,24,40,0.06);
  box-shadow: 0 6px 20px rgba(15,30,45,0.06);
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.topbar-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 22px;
}

.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.app-version {
  padding: 5px 10px;
  background: rgba(15,30,45,0.03);
  color: #dff6ff;
  border: 1px solid rgba(15,30,45,0.04);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.nav .nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 16px;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.nav .nav-link:hover,
.nav .nav-link:focus-visible {
  background: var(--gradient-brand);
  color: var(--text-inverse);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.nav .nav-link.is-active,
.nav .nav-link.active {
  background: var(--gradient-brand);
  color: var(--text-inverse);
  box-shadow: 0 6px 24px rgba(37,99,235,0.12);
  transform: translateY(-2px);
}

/* Responsive nav: allow horizontal scroll on small screens */
@media (max-width: 768px) {
  .nav { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .nav .nav-link { white-space: nowrap; }
}

.userbox,
.userbox-name {
  color: var(--text-primary);
}

.userbox-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0.45));
  border: 1px solid rgba(37,99,235,0.06);
  color: var(--text-primary);
  backdrop-filter: blur(6px);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.userbox-name:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.userbox-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(13,88,150,0.08);
  padding: 8px 0;
  display: none;
  z-index: 80;
}

.userbox:hover .userbox-menu,
.userbox:focus-within .userbox-menu { display: block; }

.userbox-menu-item {
  display: block;
  padding: 8px 12px;
  color: var(--text-primary);
  text-decoration: none;
}

.userbox-menu-item:hover { background: rgba(37,99,235,0.04); color: var(--primary); }

/* Brand icon refinements */
.topbar .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-brand);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(37,99,235,0.12);
}

@media (max-width: 768px) {
  .topbar-inner { padding: 12px 14px; }
  .brand { font-size: 16px; }
  .topbar .brand-icon { width: 30px; height: 30px; }
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 22px 40px;
}

.page-head {
  margin: 0 0 18px;
}

.page-head-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 22px;
}

.title-block {
  flex: 1 1 auto;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.page-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ph-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}

.ph-action svg { display: inline-block; vertical-align: middle; }
.ph-action-label { display: inline-block; }

.page-head h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.03em;
}

.page-head p,
.panel-header p,
.summary-chip .k,
.portal-kpi .kpi-label,
.timeline-body,
.onec-input span,
.appointment-time {
  color: var(--muted);
}

.muted,
.small {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.danger-text {
  color: #ff9786;
}

.card,
.login-card,
.exchange-panel,
.summary-chip,
.portal-kpi,
.timeline-item,
.onec-form,
.onec-right,
.code-block,
.table-wrap,
.week-scheduler-grid,
.appointment-card,
.portal-hero {
  background: linear-gradient(180deg, var(--panel-bg), var(--panel-bg-strong));
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

/* Two-column layout used by entity cards */
.two-column {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.two-column-main {
  flex: 1 1 65%;
}
.two-column-aside {
  flex: 0 0 340px;
}

.notes-form textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 80px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-bg);
}

.notes-list li { margin-bottom: 8px; }

/* Pictogram action: make icons square and compact */
.ph-action { min-width: 40px; justify-content: center; }

/* --- migrated inline styles (utility classes) -------------------------------- */
.inl-week-nav { margin-top: 10px; padding: 0 22px; }
.inl-toolbar { background: var(--panel-bg-strong); padding: 12px; border-radius: 8px; margin-bottom: 16px; }
.inl-muted-meta { margin-bottom: 12px; color: var(--text-secondary); font-size: 14px; }
.inl-card-hero { margin-bottom: 2rem; }
.inl-grid { /* placeholder for elements that provide dynamic CSS vars via data-attributes */ }

/* End migrated inline styles */
.ph-action svg { width: 18px; height: 18px; }
.ph-action .ph-action-label { display: none; }

/* Specific small adjustments for page head actions */
.page-head-actions .ph-action[title] { padding: 8px; }

.mt-12 { margin-top: 12px; }

.card,
.login-card,
.portal-kpi,
.timeline-item,
.onec-form,
.onec-right,
.appointment-card {
  padding: 18px;
}

.card h2,
.card h3,
.login-card h1,
.login-card h2,
.exchange-panel h2,
.exchange-panel h3 {
  color: var(--text);
}

.hero-card,
.portal-hero {
  background: linear-gradient(135deg, rgba(11,116,222,0.18), var(--panel-bg));
  border-color: rgba(11,116,222,0.12);
}

.portal-kpi,
.summary-chip,
.timeline-item,
.appointment-card,
.onec-input,
.onec-subtabs span,
.onec-subtabs .onec-subtab,
.week-appointment {
  background: rgba(15,30,45,0.02);
}

/* Utility helpers for migrated inline styles */
.hidden { display: none !important; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.w-120 { width: 120px; }
.w-260 { min-width: 260px; width: 100%; margin-bottom: 6px; }
.btn-auto { width: auto; }
.icon-btn { display:inline-flex; background:none; border:none; padding:0; cursor:pointer; align-items:center; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; max-height: 70vh; overflow: auto; background: #f6f8fa; padding: 12px; border-radius: 6px; }
.img-thumb { max-width:160px; max-height:160px; border-radius:8px; display:block; }
.inline-form-gap { display:flex; gap:12px; }
.spinner-wrap { display:none; position:fixed; inset:0; align-items:center; justify-content:center; background:rgba(0,0,0,0.35); z-index:9999; }
.spinner-wrap .spinner { width:28px; height:28px; border:4px solid #ddd; border-top-color:var(--primary); border-radius:50%; animation: spin 1s linear infinite; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(11,116,222,0.18);
  background: rgba(11,116,222,0.18);
  color: #eaf6ff;
  font-size: 12px;
  font-weight: 600;
}

.badge-soft {
  background: rgba(15,30,45,0.03);
  border-color: rgba(15,30,45,0.04);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,30,45,0.04);
  background: rgba(15,30,45,0.02);
  color: #dfeffb;
  font-size: 12px;
  font-weight: 700;
}

.status-new,
.status-open {
  background: rgba(11,116,222,0.16);
  border-color: rgba(11,116,222,0.26);
}

.status-in_progress,
.status-overdue {
  background: rgba(255, 184, 77, 0.16);
  border-color: rgba(255, 184, 77, 0.24);
  color: #ffe0a3;
}

.status-done,
.status-closed {
  background: rgba(72, 199, 142, 0.16);
  border-color: rgba(72, 199, 142, 0.24);
  color: #c8ffd8;
}

.status-ignored,
.status-cancelled,
.status-failed {
  background: rgba(255, 120, 120, 0.12);
  border-color: rgba(255, 120, 120, 0.2);
  color: #ffc0c0;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-bg);
  color: #1f2b33; /* darker gray for better visibility */
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tab-link:hover,
.tab-link:focus-visible {
  background: var(--panel-bg-strong);
  border-color: rgba(46,155,230,0.16);
  color: #0b1b23;
}

.tab-link.is-active {
  background: linear-gradient(180deg, rgba(46,155,230,0.12), rgba(46,155,230,0.06));
  border-color: rgba(46,155,230,0.22);
  color: #052636;
}

button,
.btn-primary,
.btn-secondary,
.btn-lite,
.btn-ghost,
.btn-run,
.btn-view-log,
input[type="submit"] {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(133, 197, 255, 0.14);
  background: linear-gradient(180deg, rgba(46, 155, 230, 0.94), rgba(13, 111, 184, 0.94));
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(10, 78, 141, 0.24);
}

.btn-secondary,
.btn-lite,
.btn-ghost,
.btn-view-log {
  background: rgba(255, 255, 255, 0.05);
  color: #e8f2fb;
  box-shadow: none;
}

button:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-lite:hover,
.btn-ghost:hover,
.btn-run:hover,
.btn-view-log:hover,
input[type="submit"]:hover {
  filter: brightness(1.08);
}

input,
select,
textarea {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(133, 197, 255, 0.14);
  background: var(--panel-bg);
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: #8da6bf;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(143, 209, 255, 0.36);
  box-shadow: 0 0 0 4px rgba(46, 155, 230, 0.14);
}

.inline-form,
.toolbar,
.portal-filters {
  display: grid;
  gap: 12px;
}

.toolbar {
  grid-template-columns: repeat(auto-fit, minmax(180px, auto));
  align-items: end;
}

.spacer {
  flex: 1 1 auto;
}

.form-grid label,
.onec-form label,
label {
  color: #d6e9fb;
}

.page-eyebrow,
.panel-kicker {
  display: inline-block;
  margin-bottom: 10px;
  color: #8fd1ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.modern-head {
  overflow: hidden;
}

.inline-form {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

.table-wrap {
  overflow: auto;
  padding: 6px;
}

table,
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
}

thead th {
  position: sticky;
  top: 0;
  background: var(--panel-bg-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

tbody tr:hover {
  background: rgba(46,155,230,0.03);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-bg);
  color: var(--text);
  text-decoration: none;
}

.pagination a.current {
  background: linear-gradient(180deg, rgba(46, 155, 230, 0.24), rgba(46, 155, 230, 0.1));
  border-color: rgba(143, 209, 255, 0.22);
}

.exchange-note,
.appointment-notes {
  background: rgba(255, 216, 102, 0.08);
  border-color: rgba(255, 216, 102, 0.22);
  color: #ffe9a8;
}

.card-link,
.timeline-link,
.week-appointment,
.onec-subtabs .onec-subtab {
  color: var(--primary);
}

.timeline-link:hover,
.week-appointment:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(143, 209, 255, 0.18);
}

.time-col-head,
.day-col-head,
.time-col {
  background: rgba(255, 255, 255, 0.03);
  color: #c9ddf0;
}

.day-col {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--slot-height) - 1px),
    rgba(255, 255, 255, 0.06) calc(var(--slot-height) - 1px),
    rgba(255, 255, 255, 0.06) var(--slot-height)
  );
}

.week-appointment {
  border: 1px solid rgba(143, 209, 255, 0.18);
  border-left: 4px solid var(--primary);
  color: var(--text);
}

.portal-kpi .kpi-value,
.summary-chip .v,
.timeline-time,
.panel-header h2,
.onec-right h3 {
  color: var(--text);
}

.portal-status-block {
  box-shadow: inset 0 0 0 1px rgba(143, 209, 255, 0.18);
}

.code-block.is-dark,
.code-block {
  background: rgba(5, 13, 24, 0.85);
  border-color: rgba(143, 209, 255, 0.12);
  color: #d7ebff;
}

@media (max-width: 980px) {
  .topbar-inner {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .nav {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 16px 12px 28px;
  }

  .page-head h1 {
    font-size: 24px;
  }

  .card,
  .login-card,
  .appointment-card,
  .portal-kpi,
  .timeline-item,
  .onec-form,
  .onec-right {
    padding: 14px;
    border-radius: 16px;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }
}

/* Page-specific reset/password styles moved from inline blocks */
.reset-info {
  font-size: 0.95em;
  color: var(--muted);
  margin-bottom: 1.2em;
  line-height: 1.5;
}

.back-link {
  margin-top: 1em;
  text-align: center;
}
.back-link a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.95em;
}
.back-link a:hover {
  color: #bfe9ff;
  text-decoration: underline;
}

.reset-form {
  display: flex;
  flex-direction: column;
  gap: 1em;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}
.form-group label {
  font-weight: 600;
  font-size: 0.95em;
  color: #f0f8ff;
}
.form-group input {
  padding: 0.75em;
  border-radius: 12px;
  border: 1px solid rgba(133,197,255,0.12);
  font-size: 1em;
  font-family: inherit;
  background: rgba(255,255,255,0.03);
  color: var(--text);
}
.form-group input:focus {
  outline: none;
  border-color: rgba(143,209,255,0.36);
  box-shadow: 0 0 0 4px rgba(46,155,230,0.14);
}

.password-note {
  font-size: 0.85em;
  color: var(--muted);
  margin-top: 0.5em;
  padding: 0.75em;
  background: rgba(255,255,255,0.03);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  line-height: 1.4;
}

.user-info {
  padding: 1em;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  margin-bottom: 1em;
  font-size: 0.95em;
  color: var(--text);
}

.login-card button {
  min-width: 160px;
}

/* Field grid items (key/value pairs) */
.field {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  padding: 10px;
  color: var(--text);
}
.field .k {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.field .v {
  font-weight: 600;
  color: var(--text);
}
