:root {
  --bg: #f4faf6;
  --surface: #ffffff;
  --surface-soft: #f8fcf9;
  --ink: #143326;
  --muted: #66776d;
  --line: #dbe9df;
  --line-strong: #c7ddd0;
  --green: #1f8f4d;
  --green-2: #65c58f;
  --green-3: #dff5e8;
  --teal: #168a87;
  --gold: #b7791f;
  --danger: #c2410c;
  --warn: #b7791f;
  --shadow: 0 18px 44px rgba(18, 65, 42, .10);
  --shadow-soft: 0 8px 24px rgba(18, 65, 42, .08);
  --ring: 0 0 0 4px rgba(47, 158, 68, .14);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Tahoma, "Noto Sans Thai", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,0) 16rem),
    radial-gradient(circle at 14% -8%, rgba(101, 197, 143, .35), transparent 26rem),
    radial-gradient(circle at 92% 2%, rgba(22, 138, 135, .12), transparent 24rem),
    linear-gradient(135deg, #f9fdfb 0%, #eef8f1 44%, #e6f4ec 100%);
  min-height: 100vh;
}
a { color: #19713a; text-decoration: none; }
input, select, textarea, button {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfffc;
  padding: 10px 12px;
  color: var(--ink);
}
textarea { resize: vertical; }
label { display: grid; gap: 6px; font-weight: 700; color: #244936; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
label.check input { width: auto; }
code { background: #e7f6ea; padding: 2px 6px; border-radius: 6px; }

.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  padding: 22px;
  background: linear-gradient(180deg, rgba(236, 253, 245, .96), rgba(209, 250, 229, .88));
  border-right: 1px solid rgba(47, 158, 68, .18);
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); margin-bottom: 28px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2f9e44, #95d5b2);
  color: white; font-weight: 800; box-shadow: 0 12px 28px rgba(47, 158, 68, .25);
}
.brand-mark.large { width: 72px; height: 72px; font-size: 28px; border-radius: 16px; }
.brand small { display: block; color: var(--muted); margin-top: 3px; }
nav { display: grid; gap: 8px; }
nav a {
  padding: 12px 14px; border-radius: 8px; color: #23523a; font-weight: 700;
}
nav a.active, nav a:hover { background: white; box-shadow: var(--shadow); color: #0b5b2d; }
.user-card {
  position: absolute; left: 22px; right: 22px; bottom: 22px;
  padding: 16px; border-radius: 8px; background: rgba(255,255,255,.72); border: 1px solid var(--line);
}
.user-card span { display: block; color: var(--muted); font-size: 13px; margin: 4px 0 10px; }

.content { padding: 26px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.topbar p { margin: 0 0 4px; color: var(--muted); font-weight: 700; }
.topbar h1 { margin: 0; font-size: 30px; letter-spacing: 0; }
.menu-toggle { display: none; border: 0; background: white; border-radius: 8px; padding: 9px 12px; box-shadow: var(--shadow); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px;
  background: white; color: #14532d; cursor: pointer; font-weight: 800;
}
.btn.primary { border: 0; background: linear-gradient(135deg, #2f9e44, #74c69d); color: white; box-shadow: 0 10px 24px rgba(47, 158, 68, .25); }
.btn.ghost { background: #f7fff8; }
.btn.full { width: 100%; }

.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid #b7ebc1; background: #e9fbe9; color: #19612f; font-weight: 700; }
.alert.error { background: #fff0ea; border-color: #ffd5c2; color: #a13b10; }
.panel, .metric, .detail-hero {
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(47, 158, 68, .14);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel { padding: 18px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2, .panel h2, .panel h3 { margin: 0; }
.panel h3 { margin-top: 16px; font-size: 16px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric { padding: 18px; overflow: hidden; position: relative; }
.metric span, .metric small { color: var(--muted); font-weight: 700; }
.metric strong { display: block; font-size: 34px; margin: 6px 0; }
.metric.warn strong { color: var(--warn); }
.metric.danger strong { color: var(--danger); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #496253; font-size: 13px; }
td small { display: block; color: var(--muted); margin-top: 4px; }
.compact table { min-width: 520px; }
.empty { color: var(--muted); text-align: center; padding: 18px; }
.pill, .severity {
  --pill: var(--green);
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 5px 9px; background: color-mix(in srgb, var(--pill) 14%, white); color: var(--pill); font-weight: 800;
}
.severity { min-width: 34px; justify-content: center; }
.severity.big { font-size: 28px; min-width: 62px; height: 62px; border-radius: 14px; }
.status {
  display: inline-flex; border-radius: 999px; padding: 5px 9px; font-weight: 800;
  background: #eef7ef; color: #2b6942;
}
.status.closed { background: #e7f5ff; color: #1864ab; }
.status.rejected { background: #fff0f0; color: #c92a2a; }
.status.investigating, .status.corrective_action { background: #fff4e6; color: #d9480f; }

.bars, .status-list, .timeline, .file-list, .stack, .mini-form { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 54px 1fr 34px; align-items: center; gap: 10px; }
.bar-row div { height: 12px; background: #e8f5ea; border-radius: 999px; overflow: hidden; }
.bar-row i { display: block; height: 100%; background: linear-gradient(90deg, #2f9e44, #95d5b2); border-radius: 999px; }
.severity-strip { display: grid; grid-template-columns: repeat(9, 1fr); gap: 7px; margin-bottom: 16px; }
.severity-strip span { background: color-mix(in srgb, var(--c) 14%, white); color: var(--c); padding: 10px 6px; border-radius: 8px; text-align: center; font-weight: 900; }
.severity-strip b { display: block; color: var(--ink); margin-top: 4px; }
.status-list div, .file-list a, .timeline div {
  padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfffc;
}
.status-list div { display: flex; justify-content: space-between; }
.timeline p { margin: 6px 0; }
.timeline small, .file-list small { color: var(--muted); display: block; }

.filters { display: grid; grid-template-columns: 2fr repeat(4, minmax(130px, 1fr)) auto auto; gap: 10px; align-items: center; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.wide { grid-column: 1 / -1; }
.form-actions, .inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mini-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.detail-hero { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 20px; margin-bottom: 18px; }
.detail-hero h2 { margin: 10px 0 8px; font-size: 28px; }
.detail-hero p { margin: 0; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; align-items: center; }
.info-list, .print-grid { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; }
.info-list dt, .print-grid dt { color: var(--muted); font-weight: 800; }
.info-list dd, .print-grid dd { margin: 0; }

.donut-list, .kpi-list, .severity-cards { display: grid; gap: 12px; }
.donut-list div { position: relative; display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; overflow: hidden; }
.donut-list span { width: 12px; height: 12px; border-radius: 99px; background: var(--pill); }
.donut-list em { grid-column: 1 / -1; height: 8px; background: linear-gradient(90deg, var(--green), var(--green-2)); border-radius: 999px; }
.kpi-list { grid-template-columns: repeat(2, 1fr); }
.kpi-list div, .severity-cards div { padding: 14px; border-radius: 8px; background: #f7fff8; border: 1px solid var(--line); }
.kpi-list strong { display: block; font-size: 28px; color: var(--green); }
.kpi-list small { color: var(--muted); }
.severity-cards { grid-template-columns: repeat(9, 1fr); }
.severity-cards div { border-top: 4px solid var(--pill); text-align: center; }
.severity-cards strong { display: block; font-size: 24px; color: var(--pill); }
.severity-cards small, .severity-cards span { display: block; color: var(--muted); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--line); background: white; border-radius: 8px; padding: 10px 12px; color: var(--ink); cursor: pointer; font-weight: 800; }
.tabs button.active { background: var(--green); color: white; border-color: var(--green); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.split { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-wrap { width: min(980px, 100%); display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; align-items: stretch; }
.login-hero, .login-card {
  border-radius: 8px; padding: 32px; background: rgba(255,255,255,.84); border: 1px solid rgba(47,158,68,.16); box-shadow: var(--shadow);
}
.login-hero { background: linear-gradient(135deg, rgba(255,255,255,.88), rgba(216,243,220,.88)); }
.login-hero h1 { font-size: 42px; margin: 26px 0 12px; letter-spacing: 0; }
.login-hero p { color: var(--muted); line-height: 1.8; font-weight: 700; }
.login-card { display: grid; gap: 14px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }

.print-page { background: white; }
.print-sheet { max-width: 840px; margin: 20px auto; padding: 26px; color: #111; }
.print-sheet h1 { text-align: center; }

@media (max-width: 1100px) {
  .metric-grid, .grid.two, .login-wrap, .split { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .severity-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 10; transform: translateX(-100%); transition: .2s ease; width: 280px; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .content { padding: 16px; }
  .menu-toggle { display: inline-flex; }
  .topbar h1 { font-size: 24px; }
  .topbar .btn.primary { display: none; }
  .metric-grid, .form-grid, .filters, .kpi-list { grid-template-columns: 1fr; }
  .severity-strip { grid-template-columns: repeat(3, 1fr); }
  .detail-hero, .hero-actions { align-items: flex-start; flex-direction: column; }
  .info-list, .print-grid { grid-template-columns: 1fr; }
  .login-hero h1 { font-size: 32px; }
}

@media print {
  .print-sheet { margin: 0; max-width: none; }
}

/* Enterprise visual refresh */
::selection { background: rgba(101, 197, 143, .28); color: var(--ink); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: none;
  border-color: rgba(31, 143, 77, .58);
  box-shadow: var(--ring);
}
input, select, textarea {
  min-height: 42px;
  border-color: var(--line-strong);
  background: linear-gradient(180deg, #ffffff, #fbfefc);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
textarea { line-height: 1.65; }

.shell { grid-template-columns: 296px minmax(0, 1fr); }
.sidebar {
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(239, 249, 242, .9)),
    linear-gradient(135deg, rgba(31,143,77,.12), rgba(22,138,135,.08));
  border-right: 1px solid rgba(31, 143, 77, .16);
  box-shadow: 10px 0 30px rgba(20, 51, 38, .04);
}
.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--green), var(--green-2), var(--teal));
}
.brand {
  padding: 10px;
  margin: -10px -10px 26px;
  border-radius: 8px;
}
.brand-mark {
  border: 1px solid rgba(255,255,255,.45);
  background: linear-gradient(135deg, #166534 0%, #1f8f4d 48%, #8bd8aa 100%);
  box-shadow: 0 12px 26px rgba(31, 143, 77, .22), inset 0 1px 0 rgba(255,255,255,.34);
}
.brand strong { font-size: 17px; letter-spacing: .2px; }
.brand small { font-size: 12px; line-height: 1.35; }
nav { gap: 6px; }
nav a {
  position: relative;
  border: 1px solid transparent;
  color: #31513f;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease, border-color .16s ease;
}
nav a:hover {
  background: rgba(255,255,255,.72);
  border-color: rgba(31, 143, 77, .14);
  box-shadow: var(--shadow-soft);
}
nav a.active {
  background: linear-gradient(135deg, #ffffff, #f4fbf6);
  border-color: rgba(31, 143, 77, .18);
  box-shadow: var(--shadow-soft);
}
nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, var(--green), var(--teal));
}
.user-card {
  background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(247,252,248,.88));
  box-shadow: var(--shadow-soft);
}
.user-card a {
  display: inline-flex;
  font-weight: 800;
  color: #166534;
}

.content {
  padding: 30px;
  background-image: linear-gradient(rgba(31,143,77,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(31,143,77,.035) 1px, transparent 1px);
  background-size: 40px 40px;
}
.topbar {
  padding: 8px 0 20px;
  border-bottom: 1px solid rgba(199, 221, 208, .78);
}
.topbar p {
  color: #5c7567;
  font-size: 12px;
  letter-spacing: .6px;
  text-transform: uppercase;
}
.topbar h1 {
  font-size: 32px;
  color: #112f22;
}
.menu-toggle {
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn {
  min-height: 42px;
  border-color: var(--line-strong);
  background: linear-gradient(180deg, #ffffff, #f8fcf9);
  box-shadow: 0 1px 0 rgba(255,255,255,.9), 0 6px 14px rgba(20,51,38,.05);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(20,51,38,.10);
}
.btn.primary {
  background: linear-gradient(135deg, #166534 0%, #1f8f4d 48%, #65c58f 100%);
  box-shadow: 0 14px 28px rgba(31, 143, 77, .24), inset 0 1px 0 rgba(255,255,255,.28);
}
.btn.ghost {
  background: rgba(255,255,255,.66);
}

.panel, .metric, .detail-hero {
  background: rgba(255,255,255,.92);
  border-color: rgba(199, 221, 208, .82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.panel {
  padding: 20px;
}
.panel-head {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(219, 233, 223, .78);
}
.panel-head h2 {
  font-size: 18px;
  color: #153b2a;
}
.metric {
  padding: 20px;
  min-height: 138px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,252,249,.96)),
    linear-gradient(135deg, rgba(31,143,77,.13), rgba(255,255,255,0));
}
.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--green), var(--green-2));
}
.metric.warn::before { background: linear-gradient(180deg, #d69e2e, #f6c453); }
.metric.danger::before { background: linear-gradient(180deg, #c2410c, #fb923c); }
.metric span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #edf8f1;
  color: #31513f;
  font-size: 12px;
}
.metric strong {
  font-size: 38px;
  letter-spacing: .2px;
  color: #0f2f20;
}

.table-wrap {
  border: 1px solid rgba(219,233,223,.86);
  border-radius: 8px;
  background: white;
}
table {
  border-collapse: separate;
  border-spacing: 0;
}
th {
  background: linear-gradient(180deg, #f7fbf8, #eef8f1);
  color: #476252;
  font-size: 12px;
  letter-spacing: .3px;
  text-transform: uppercase;
}
td {
  background: rgba(255,255,255,.86);
}
tbody tr:hover td {
  background: #f7fcf8;
}
tbody tr:last-child td {
  border-bottom: 0;
}
td strong {
  color: #153b2a;
}
.pill, .severity, .status {
  border: 1px solid color-mix(in srgb, var(--pill, var(--green)) 18%, white);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.64);
}
.severity.big {
  box-shadow: 0 12px 24px color-mix(in srgb, var(--pill) 18%, transparent), inset 0 1px 0 rgba(255,255,255,.62);
}
.status {
  border-color: rgba(31,143,77,.14);
}

.bar-row div,
.donut-list em {
  background: #e8f2ec;
  box-shadow: inset 0 1px 2px rgba(20,51,38,.07);
}
.bar-row i,
.donut-list em {
  background: linear-gradient(90deg, #1f8f4d, #65c58f, #168a87);
}
.severity-strip span,
.status-list div,
.file-list a,
.timeline div,
.kpi-list div,
.severity-cards div {
  background: linear-gradient(180deg, #ffffff, #f8fcf9);
  border-color: rgba(199, 221, 208, .82);
}
.timeline div {
  position: relative;
  padding-left: 16px;
}
.timeline div::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--green), var(--teal));
}

.filters {
  padding: 14px;
  border: 1px solid rgba(219,233,223,.9);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7fcf8);
}
.detail-hero {
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(245,252,247,.94)),
    linear-gradient(90deg, rgba(31,143,77,.15), rgba(22,138,135,.08));
}
.detail-hero h2 {
  color: #112f22;
}
.info-list {
  padding: 14px;
  border: 1px solid rgba(219,233,223,.86);
  border-radius: 8px;
  background: #fbfefc;
}

.tabs {
  padding: 6px;
  border: 1px solid rgba(199,221,208,.86);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
  box-shadow: var(--shadow-soft);
}
.tabs button {
  border-color: transparent;
  background: transparent;
}
.tabs button:hover {
  background: #f1f9f4;
}
.tabs button.active {
  background: linear-gradient(135deg, #166534, #1f8f4d);
  box-shadow: 0 10px 20px rgba(31,143,77,.20);
}

.login-page {
  background:
    linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.18)),
    radial-gradient(circle at 15% 18%, rgba(101,197,143,.45), transparent 28rem),
    radial-gradient(circle at 90% 12%, rgba(22,138,135,.16), transparent 24rem),
    linear-gradient(135deg, #f8fdf9, #e7f5ec);
}
.login-wrap {
  width: min(1040px, 100%);
}
.login-hero, .login-card {
  border-color: rgba(199, 221, 208, .88);
  box-shadow: 0 24px 70px rgba(18,65,42,.14);
}
.login-hero {
  background:
    linear-gradient(135deg, rgba(255,255,255,.88), rgba(232,247,237,.9)),
    linear-gradient(160deg, rgba(31,143,77,.18), rgba(22,138,135,.12));
}
.login-card {
  background: rgba(255,255,255,.94);
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .content { padding: 16px; background-size: 28px 28px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 24px; }
  .panel { padding: 16px; }
  .metric { min-height: auto; }
  .filters { padding: 12px; }
}

/* KWT Risk4 sample-aligned enterprise theme */
:root {
  --sidebar-w: 268px;
  --header-h: 72px;
  --sample-green-50: #f0fdf4;
  --sample-green-100: #dcfce7;
  --sample-green-300: #86efac;
  --sample-green-500: #22c55e;
  --sample-green-600: #16a34a;
  --sample-green-700: #15803d;
  --sample-green-800: #166534;
  --sample-green-900: #14532d;
  --sample-teal-50: #f0fdfa;
  --sample-teal-400: #2dd4bf;
  --sample-teal-600: #0d9488;
  --sample-teal-800: #115e59;
  --sample-gray-50: #f9fafb;
  --sample-gray-100: #f3f4f6;
  --sample-gray-200: #e5e7eb;
  --sample-gray-500: #6b7280;
  --sample-gray-700: #374151;
  --sample-gray-800: #1f2937;
  --sample-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --sample-shadow-md: 0 10px 28px rgba(15, 83, 45, .12);
}

body {
  color: var(--sample-gray-800);
  background:
    radial-gradient(circle at 100% 0%, rgba(134,239,172,.22), transparent 26rem),
    radial-gradient(circle at 0% 100%, rgba(45,212,191,.14), transparent 28rem),
    linear-gradient(135deg, var(--sample-green-50) 0%, var(--sample-teal-50) 52%, #ecfdf5 100%);
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 0;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(180deg, var(--sample-green-800) 0%, var(--sample-teal-800) 58%, var(--sample-green-900) 100%);
  border-right: 0;
  box-shadow: 4px 0 22px rgba(15, 23, 42, .18);
}

.sidebar::before {
  display: none;
}

.brand {
  margin: 0;
  padding: 22px 20px 18px;
  color: #fff;
  border-radius: 0;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
}

.brand:hover {
  color: #fff;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--sample-green-400, #4ade80), var(--sample-teal-400));
  color: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
}

.brand strong {
  color: #fff;
  font-size: 16px;
}

.brand small {
  color: rgba(255,255,255,.62);
}

nav {
  padding: 14px 0;
  gap: 0;
}

nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 1px 0;
  padding: 11px 18px 11px 20px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  color: rgba(255,255,255,.76);
  background: transparent;
  box-shadow: none;
  font-weight: 600;
}

nav a::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.32);
  box-shadow: 0 0 0 4px rgba(255,255,255,.03);
}

nav a:hover,
nav a.active {
  color: #fff;
  background: rgba(255,255,255,.11);
  border-left-color: var(--sample-green-300);
  box-shadow: none;
}

nav a.active::before {
  background: var(--sample-green-300);
}

nav a.active::after,
nav a.active::before {
  position: static;
}

.user-card {
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 16px;
  color: #fff;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  box-shadow: none;
}

.user-card strong {
  color: #fff;
}

.user-card span {
  color: rgba(255,255,255,.58);
}

.user-card a {
  color: var(--sample-green-300);
}

.content {
  padding: 0;
  background: transparent;
  background-image: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--header-h);
  margin: 0;
  padding: 0 28px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--sample-gray-200);
  box-shadow: var(--sample-shadow);
  backdrop-filter: blur(12px);
}

.topbar p {
  margin-bottom: 2px;
  color: var(--sample-gray-500);
  font-size: 12px;
  letter-spacing: .2px;
  text-transform: none;
}

.topbar h1 {
  color: var(--sample-gray-800);
  font-size: 22px;
  font-weight: 800;
}

.topbar + .alert,
.content > .metric-grid,
.content > .grid,
.content > .panel,
.content > .detail-hero,
.content > .tabs,
.content > .tab-panel,
.content > form.panel {
  margin-left: 28px;
  margin-right: 28px;
}

.content > .metric-grid,
.content > .grid,
.content > .panel,
.content > .detail-hero,
.content > .tabs,
.content > .tab-panel,
.content > form.panel {
  margin-top: 24px;
}

.metric-grid {
  gap: 18px;
}

.metric,
.panel,
.detail-hero {
  border: 1px solid var(--sample-gray-100);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--sample-shadow);
}

.metric {
  min-height: 148px;
  padding: 22px;
  cursor: default;
}

.metric:hover,
.panel:hover {
  box-shadow: var(--sample-shadow-md);
}

.metric::before {
  height: 4px;
  width: auto;
  inset: 0 0 auto 0;
  background: linear-gradient(90deg, var(--sample-green-600), var(--sample-teal-600));
}

.metric span {
  padding: 0;
  background: transparent;
  color: var(--sample-gray-500);
  font-size: 13px;
}

.metric strong {
  color: #111827;
  font-size: 34px;
}

.panel {
  padding: 0;
  overflow: hidden;
}

.panel > :not(.panel-head):not(.table-wrap) {
  margin-left: 20px;
  margin-right: 20px;
}

.panel-head {
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--sample-gray-100);
  background: #fff;
}

.panel-head h2 {
  color: var(--sample-gray-800);
  font-size: 17px;
}

.bars,
.status-list,
.donut-list,
.kpi-list,
.timeline,
.file-list,
.stack,
.mini-form,
.form-grid,
.filters,
.info-list,
.severity-strip,
.severity-cards {
  margin-top: 18px;
  margin-bottom: 20px;
}

.filters {
  margin: 20px;
  padding: 14px;
  border: 1px solid var(--sample-gray-100);
  border-radius: 12px;
  background: var(--sample-gray-50);
}

.table-wrap {
  margin: 0;
  border: 0;
  border-radius: 0;
}

table {
  min-width: 780px;
}

th {
  padding: 13px 16px;
  color: var(--sample-green-800);
  background: linear-gradient(135deg, var(--sample-green-50), var(--sample-teal-50));
  border-bottom: 2px solid var(--sample-green-200, #bbf7d0);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

td {
  padding: 13px 16px;
  color: var(--sample-gray-700);
}

tbody tr:hover td {
  background: var(--sample-green-50);
}

input,
select,
textarea {
  min-height: 46px;
  border: 1.5px solid var(--sample-gray-200);
  border-radius: 10px;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--sample-green-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,.12);
}

.btn {
  border-radius: 10px;
}

.btn.primary {
  background: linear-gradient(135deg, var(--sample-green-600), var(--sample-teal-600));
  box-shadow: 0 8px 18px rgba(22,163,74,.28);
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--sample-green-700), var(--sample-teal-700));
}

.detail-hero {
  padding: 22px;
}

.login-page {
  background:
    radial-gradient(circle at 92% 8%, rgba(45,212,191,.24), transparent 24rem),
    radial-gradient(circle at 8% 0%, rgba(134,239,172,.36), transparent 28rem),
    linear-gradient(135deg, var(--sample-green-50), var(--sample-teal-50));
}

.login-hero,
.login-card {
  border-radius: 16px;
}

.login-hero {
  color: #fff;
  background: linear-gradient(135deg, var(--sample-green-800), var(--sample-teal-800));
}

.login-hero p {
  color: rgba(255,255,255,.74);
}

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

  .sidebar {
    position: fixed;
    z-index: 50;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .topbar {
    align-items: center;
    padding: 14px 16px;
  }

  .topbar + .alert,
  .content > .metric-grid,
  .content > .grid,
  .content > .panel,
  .content > .detail-hero,
  .content > .tabs,
  .content > .tab-panel,
  .content > form.panel {
    margin-left: 16px;
    margin-right: 16px;
  }
}

/* กำหนด logo login */
/* ===== Logo ทั้งระบบ ===== */
.brand-mark,
.logo-mark {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    box-shadow: none;
    padding: 4px;
}

.brand-mark img,
.logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* สำคัญ */
    display: block;
}

/* Sidebar Logo */
.sidebar .brand-mark {
    width: 52px;
    height: 52px;
}

/* Login Logo */
.login-page .brand-mark.large {
    width: 110px;
    height: 110px;
    margin: 0 auto 20px;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.login-page .brand-mark.large img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

nav a {
  justify-content: flex-start;
}
.nav-badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #f97316);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(239, 68, 68, .28);
}
.user-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.upload-field small {
  color: var(--muted);
  font-weight: 500;
}
.profile-panel .form-grid {
  padding: 20px;
}
.profile-avatar-block {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fcf9;
}
.profile-avatar {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  border-radius: 18px;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: var(--shadow-soft);
}
.empty-avatar {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--teal));
  font-size: 34px;
  font-weight: 800;
}
.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}
.row-actions form {
  display: inline;
}
.btn.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}
.btn.danger {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #dc2626, #f97316);
}
@media (max-width: 760px) {
  .profile-avatar-block,
  .row-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}