:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #0f766e;
  --primary-hover: #0d625b;
  --primary-soft: #ecfdf5;
  --primary-border: #99f6e4;
  --emerald: #059669;
  --emerald-soft: #d1fae5;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --rose: #e11d48;
  --rose-soft: #ffe4e6;
  --slate-soft: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

.hidden {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.section-pad {
  padding-top: 28px;
  padding-bottom: 56px;
}

.stack-md {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.muted {
  color: var(--text-muted);
  margin: 4px 0 0;
  font-size: 0.95rem;
}

.muted-sm {
  color: var(--text-muted);
  margin: 2px 0 0;
  font-size: 0.85rem;
}

.req {
  color: var(--rose);
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(22px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes logoPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.22);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(15, 118, 110, 0);
    transform: scale(1.03);
  }
}

@keyframes popValue {
  0% {
    opacity: 0.4;
    transform: scale(0.92);
  }
  60% {
    opacity: 1;
    transform: scale(1.04);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.view-animate {
  animation: fadeSlideUp 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ==================== LANGUAGE SWITCHER ==================== */
.lang-switch {
  display: inline-flex;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 118, 110, 0.28);
}

/* ==================== DEMO BANNER ==================== */
.demo-banner {
  background: linear-gradient(90deg, #0f766e, #115e59);
  color: #ffffff;
  font-size: 0.85rem;
  padding: 8px 16px;
  animation: fadeSlideDown 0.28s ease-out;
}

.demo-banner code {
  background: rgba(255, 255, 255, 0.18);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.demo-banner-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==================== TOPBAR ==================== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.topbar .container {
  max-width: 1260px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 0.96rem;
  line-height: 1.25;
}

.brand-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.nav-tab.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-border);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.user-chip-name {
  font-weight: 600;
  max-width: 135px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== CARDS & FORMS ==================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.login-wrapper {
  min-height: calc(100vh - 50px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 450px;
  padding: 28px 32px 32px;
  box-shadow: var(--shadow-md);
}

.login-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.login-portal-tag {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  padding: 4px 10px;
  border-radius: 999px;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: logoPulse 3.4s ease-in-out infinite;
}

.login-header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.login-notice {
  margin-top: 20px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.login-notice svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.demo-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: #f0fdfa;
  border: 1px dashed #5eead4;
}

.demo-box-title {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--primary);
}

.demo-box-desc {
  margin: 4px 0 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.demo-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="search"],
.field select,
.field textarea,
.search-input,
.select-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus,
.select-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.field-hint {
  font-size: 0.79rem;
  color: var(--text-muted);
}

.field-hint.error-text {
  color: var(--rose);
  font-weight: 600;
}

.field-hint.success-text {
  color: var(--emerald);
  font-weight: 600;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  padding-right: 70px;
}

.toggle-pw-btn {
  position: absolute;
  right: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle-pw-btn:hover {
  color: var(--text);
}

/* ==================== BUTTONS & BADGES ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.14s ease, background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.96rem;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.83rem;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 0.76rem;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.24);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--surface-soft);
}

.btn-outline-light {
  background: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-soft);
  color: var(--text);
}

.btn-danger-outline {
  background: var(--surface);
  color: var(--rose);
  border-color: #fecdd3;
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--rose-soft);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-teal {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-emerald {
  background: var(--emerald-soft);
  color: #065f46;
}

.badge-amber {
  background: var(--amber-soft);
  color: #92400e;
}

.badge-rose {
  background: var(--rose-soft);
  color: #9f1239;
}

.badge-slate {
  background: var(--slate-soft);
  color: #475569;
}

/* ==================== ALERTS ==================== */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  border: 1px solid transparent;
}

.alert-error {
  background: var(--rose-soft);
  color: #9f1239;
  border-color: #fecdd3;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.alert-success {
  background: var(--emerald-soft);
  color: #065f46;
  border-color: #a7f3d0;
}

.alert-warning {
  background: var(--amber-soft);
  color: #92400e;
  border-color: #fde68a;
}

/* ==================== STAFF FORM ==================== */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.form-card {
  padding: 28px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.form-section-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.step-pill {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

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

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* IC Auto-Calc Card */
.ic-preview-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.ic-preview-card.valid {
  background: #f0fdfa;
  border-color: var(--primary-border);
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.08);
}

.ic-preview-value.pop-value {
  animation: popValue 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.ic-preview-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ic-preview-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 600;
}

.ic-preview-value {
  font-size: 0.98rem;
  color: var(--text);
}

.ic-preview-value.highlight {
  color: var(--primary);
  font-size: 1.08rem;
}

/* Status Radio Cards */
.status-radio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.status-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  transition: transform 0.16s ease, border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.status-card input {
  margin-top: 3px;
  accent-color: var(--primary);
}

.status-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.status-card.selected.status-healthy {
  border-color: var(--emerald);
  background: #ecfdf5;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.12);
}

.status-card.selected.status-monitor {
  border-color: var(--amber);
  background: #fffbeb;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.12);
}

.status-card.selected.status-issue {
  border-color: var(--rose);
  background: #fff1f2;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.12);
}

.status-card-title {
  font-weight: 700;
  font-size: 0.92rem;
}

.status-card-desc {
  font-size: 0.79rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Conditions Grid */
.conditions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.condition-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 500;
  transition: transform 0.14s ease, border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.condition-chip:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.condition-chip input {
  accent-color: var(--primary);
}

.condition-chip.checked {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
  animation: popValue 0.25s ease-out;
}

.checkbox-ack {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
}

.checkbox-ack input {
  margin-top: 3px;
  accent-color: var(--primary);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

/* ==================== ADMIN DASHBOARD ==================== */
.admin-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: fadeSlideUp 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.kpi-card:nth-child(2) {
  animation-delay: 0.05s;
}

.kpi-card:nth-child(3) {
  animation-delay: 0.1s;
}

.kpi-card:nth-child(4) {
  animation-delay: 0.15s;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.kpi-card.kpi-teal {
  border-left: 4px solid var(--primary);
}

.kpi-card.kpi-emerald {
  border-left: 4px solid var(--emerald);
}

.kpi-card.kpi-rose {
  border-left: 4px solid var(--rose);
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 4px;
  line-height: 1.15;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.subtab {
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
}

.subtab:hover {
  color: var(--text);
  background: var(--surface);
}

.subtab.active {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.table-card {
  overflow: hidden;
}

.toolbar {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 500px;
}

.search-input {
  flex: 1 1 240px;
  min-width: 200px;
}

.select-input {
  width: auto;
  min-width: 165px;
}

.toolbar-exports {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  text-align: left;
}

.data-table th {
  background: var(--surface-soft);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table tbody tr {
  transition: background-color 0.14s ease;
  animation: fadeIn 0.24s ease-out both;
}

.data-table tbody tr:hover {
  background: #f5fbfa;
}

.cell-main {
  font-weight: 700;
  color: var(--text);
}

.cell-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mini-chip {
  display: inline-block;
  padding: 2px 7px;
  background: var(--slate-soft);
  border-radius: 6px;
  font-size: 0.75rem;
  color: #334155;
}

.action-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fadeIn 0.18s ease-out both;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  animation: modalPop 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal.modal-lg {
  max-width: 680px;
}

.modal.modal-sm {
  max-width: 420px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.08rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.modal-footer,
.modal-footer-inline {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.modal-footer-inline {
  padding: 10px 0 0;
  border-top: 0;
}

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

.detail-item {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.detail-item.full {
  grid-column: 1 / -1;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.detail-value {
  margin-top: 4px;
  font-size: 0.92rem;
  font-weight: 500;
  word-break: break-word;
}

.credentials-box {
  margin: 8px 0;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.85rem;
}

/* ==================== TOASTS ==================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  max-width: 360px;
  animation: toastSlideIn 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.toast-leaving {
  opacity: 0;
  transform: translateX(18px);
}

.toast.toast-success {
  background: #065f46;
}

.toast.toast-error {
  background: #9f1239;
}

/* ==================== RESPONSIVE & PRINT ==================== */
@media (max-width: 860px) {
  .kpi-grid,
  .ic-preview-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .status-radio-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .grid-2,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .form-card,
  .login-card {
    padding: 20px;
  }
  .topbar-inner {
    gap: 10px;
  }
}

@media print {
  .demo-banner,
  .topbar,
  .admin-head-actions,
  .subtabs,
  .toolbar,
  .no-print,
  .toast-container {
    display: none !important;
  }
  body {
    background: #ffffff;
  }
  .card {
    box-shadow: none;
    border: 1px solid #cbd5e1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
