/* ------------------------------------------------------------
   ฟอนต์ของทั้งระบบ: IBM Plex Sans Thai (โหลดจาก Google Fonts ใน index.php)
   ชุดเดียวกับพอทอลและทุกระบบในเครือ
   ------------------------------------------------------------ */

:root {
    --bg: #f3f4f6;
    --panel: #ffffff;
    --panel-soft: #fafafa;
    --line: #e5e7eb;
    --text: #1f2937;
    --muted: #6b7280;

    --sidebar-red: #b30000;
    --sidebar-red-dark: #8f0000;
    --sidebar-red-light: #d71b1b;

    --blue: #2563eb;
    --green: #16a34a;
    --yellow: #eab308;
    --orange: #f59e0b;
    --purple: #7c3aed;
    --pink: #ec4899;
    --danger: #dc2626;

    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.05);
    --radius: 18px;
    --sidebar-width: 280px;
    --topbar-height: 84px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: 'IBM Plex Sans Thai', 'Noto Sans Thai', Tahoma, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

body {
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* =========================
   ADMIN LAYOUT
========================= */
.admin-body {
    background: var(--bg);
}

.admin-layout {
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}

.admin-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-red-light), var(--sidebar-red), var(--sidebar-red-dark));
    color: #fff;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 8px 0 20px rgba(0, 0, 0, 0.08);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1200;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.14);
    display: grid;
    place-items: center;
    font-size: 28px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.sidebar-brand-title {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.05;
}

.sidebar-brand-subtitle {
    margin-top: 4px;
    font-size: .88rem;
    color: rgba(255, 255, 255, 0.84);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1rem;
}

.sidebar-user-info {
    display: grid;
    gap: 2px;
}

.sidebar-user-info strong {
    font-size: .98rem;
}

.sidebar-user-info span {
    font-size: .84rem;
    color: rgba(255, 255, 255, 0.82);
}

.sidebar-section-title {
    padding: 0 8px;
    font-size: .86rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.78);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.94);
    font-weight: 700;
    transition: all .18s ease;
    border: 1px solid transparent;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.10);
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.sidebar-link-icon {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-link-label {
    line-height: 1.2;
}

.sidebar-spacer {
    flex: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.10);
    display: grid;
    gap: 10px;
}

.sidebar-footer-time,
.sidebar-footer-version {
    font-size: .9rem;
    color: rgba(255, 255, 255, 0.86);
}

.sidebar-logout-form {
    margin: 0;
}

.sidebar-logout-btn {
    width: 100%;
    padding: 12px 14px;
    border: 0;
    border-radius: 12px;
    background: #fff;
    color: var(--sidebar-red);
    font-weight: 800;
    cursor: pointer;
}

.sidebar-logout-btn:hover {
    background: #fff5f5;
}

.sidebar-overlay {
    display: none;
}

.admin-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.content-topbar {
    min-height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    padding: 18px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.content-topbar-left,
.content-topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.content-topbar-right {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sidebar-toggle-btn {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    font-size: 1.2rem;
}

.content-page-meta {
    display: grid;
    gap: 4px;
}

.content-breadcrumb {
    font-size: .92rem;
    color: var(--muted);
    font-weight: 700;
}

.content-page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.6rem;
    font-weight: 800;
    color: #111827;
}

.content-page-icon {
    font-size: 1.4rem;
}

.content-date-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid var(--line);
    color: #4b5563;
    font-weight: 700;
    white-space: nowrap;
}

.topbar-account-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid var(--line);
}

.topbar-account-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #3b82f6;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.topbar-account-info {
    display: grid;
    gap: 1px;
}

.topbar-account-info strong {
    font-size: .92rem;
}

.topbar-account-info span {
    font-size: .78rem;
    color: var(--muted);
}

.page-wrap {
    padding: 26px;
    max-width: 100%;
}

.admin-page-wrap {
    width: 100%;
}

/* =========================
   OLD LAYOUT COMPAT
========================= */
.app-shell {
    min-height: 100vh;
}

.topbar,
.menu-bar {
    display: none;
}

/* =========================
   PANELS / CARDS
========================= */
.hero,
.panel,
.stat-card,
.service-card,
.type-card,
.list-card,
.pm-card,
.kpi-card,
.simple-row,
.calendar-cell {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.hero {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 28px 30px;
    margin-bottom: 20px;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: 2rem;
    line-height: 1.1;
}

.hero p {
    margin: 0;
    color: var(--muted);
}

.hero-gradient {
    background: linear-gradient(90deg, #fff4f4, #fff8e9);
}

.hero-yellow {
    background: linear-gradient(90deg, #fff1a8, #ffe6a8);
}

.hero-blue {
    background: linear-gradient(90deg, #e9f1ff, #f3f8ff);
}

.hero-pink {
    background: linear-gradient(90deg, #fdf2f8, #f5f3ff);
}

.hero-soft {
    background: linear-gradient(90deg, #f8fafc, #f1f5f9);
}

.hero-icon {
    font-size: 46px;
}

.space-between {
    justify-content: space-between;
}

.panel {
    padding: 22px;
    margin-bottom: 20px;
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 18px;
    color: #111827;
}

.slim-panel {
    padding: 14px 22px;
}

/* =========================
   GRID
========================= */
.cards-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 20px;
}

.five-up {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.four-up {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.three-up {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* =========================
   STATS
========================= */
.stat-card {
    padding: 22px;
    min-height: 140px;
}

.stat-title {
    color: #4b5563;
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: #111827;
}

.stat-meta {
    margin-top: 10px;
    color: var(--muted);
}

.tone-blue {
    background: #eff6ff;
}

.tone-green {
    background: #f0fdf4;
}

.tone-yellow {
    background: #fffbeb;
}

.tone-pink {
    background: #fff1f2;
}

.tone-cream {
    background: #fffdf5;
}

/* =========================
   TYPE / PROGRESS
========================= */
.type-card {
    padding: 22px;
}

.type-card.hw {
    background: #fff9e5;
}

.type-card.sw {
    background: #eff6ff;
}

.type-card.pw {
    background: #f5f0ff;
}

.type-head {
    font-weight: 800;
    color: #4b5563;
    margin-bottom: 12px;
}

.type-number {
    font-size: 2.2rem;
    font-weight: 800;
}

.type-number span {
    font-size: 1rem;
    color: var(--muted);
}

.type-meta {
    margin: 10px 0;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.progress,
.bar {
    height: 10px;
    background: #eceff4;
    border-radius: 999px;
    overflow: hidden;
}

.progress span,
.bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
}

.progress span {
    background: linear-gradient(90deg, var(--orange), var(--purple));
}

.bar span {
    background: linear-gradient(90deg, var(--sidebar-red-light), var(--sidebar-red-dark));
}

.bar.blue span {
    background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.rank-list {
    display: grid;
    gap: 14px;
}

.rank-item {
    display: grid;
    gap: 8px;
}

.rank-label,
.rank-count {
    font-weight: 700;
}

.rank-count,
.rank-value {
    color: var(--muted);
}

/* =========================
   TABLE
========================= */
.table-wrap {
    overflow: auto;
    border-radius: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: #6b7280;
    font-size: .93rem;
    font-weight: 800;
    background: #fafafa;
    white-space: nowrap;
}

td {
    color: #111827;
}

tbody tr:hover td {
    background: #fcfcfc;
}

/* =========================
   BADGES / TAGS
========================= */
.badge,
.tag,
.pill-soft,
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: .84rem;
    font-weight: 800;
    line-height: 1.1;
}

.badge.hw,
.tag.hw,
.pill.hw {
    background: #fef3c7;
    color: #a16207;
}

.badge.sw,
.tag.sw,
.pill.sw {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge.pw,
.tag.pw,
.pill.pw {
    background: #ede9fe;
    color: #6d28d9;
}

.badge.success {
    background: #dcfce7;
    color: #15803d;
}

.badge.warning {
    background: #fef3c7;
    color: #b45309;
}

.badge.danger {
    background: #fee2e2;
    color: #b91c1c;
}

.badge.info {
    background: #e0f2fe;
    color: #0369a1;
}

.badge.muted {
    background: #e5e7eb;
    color: #4b5563;
}

.tag {
    font-weight: 700;
    background: #f3f4f6;
    color: #4b5563;
}

.pill-soft {
    background: #e9f2ff;
    color: #2563eb;
}

/* =========================
   FORMS
========================= */
.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three-up {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.four-up {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.full-span {
    grid-column: 1 / -1;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: #374151;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid #d6dde8;
    background: #fff;
    color: #111827;
    transition: border-color .2s ease, box-shadow .2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="file"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.align-end {
    align-items: end;
}

.top-gap {
    margin-top: 16px;
}

.inline-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.inline-form input {
    flex: 1 1 300px;
}

.inline-mini-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-mini-form select {
    min-width: 150px;
}

/* =========================
   BUTTONS
========================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 800;
    width: auto;
    transition: all .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--sidebar-red-light), var(--sidebar-red));
    color: #fff;
    border-color: transparent;
}

.btn-primary:hover {
    filter: brightness(1.03);
}

.btn-light {
    background: #fff;
    color: #111827;
    border-color: #d6dde8;
}

.btn-light:hover {
    background: #fafafa;
}

.btn-danger {
    background: #fff5f5;
    color: #b91c1c;
    border-color: #fecaca;
}

.btn-small {
    padding: 9px 12px;
    border-radius: 12px;
    font-size: .9rem;
}

.btn-block {
    width: 100%;
}

/* =========================
   SEARCH / LIST / SERVICE
========================= */
.search-bar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-bar input {
    flex: 1;
}

.stack-gap {
    display: grid;
    gap: 16px;
}

.list-card {
    padding: 18px 20px;
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 16px;
    align-items: center;
}

.list-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 28px;
    background: #f3f4f6;
}

.list-content h3 {
    margin: 0 0 8px;
    font-size: 1.35rem;
}

.list-content p {
    margin: 0 0 10px;
    color: var(--muted);
}

.list-side {
    display: grid;
    gap: 10px;
    justify-items: end;
    color: var(--muted);
}

.tag-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.views {
    font-size: .92rem;
    color: var(--muted);
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.service-card {
    padding: 26px 20px;
    text-align: center;
    transition: transform .18s ease, box-shadow .18s ease;
}

.service-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.service-icon {
    font-size: 38px;
    margin-bottom: 14px;
}

.service-name {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 10px;
}

/* =========================
   PM / CALENDAR / KPI
========================= */
.pm-card {
    padding: 22px;
}

.pm-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.pm-head h3 {
    margin: 0;
    font-size: 1.6rem;
}

.pm-head p {
    margin: 6px 0 0;
    color: var(--muted);
}

.pm-percent {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sidebar-red-light), var(--purple));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.pm-list {
    display: grid;
    gap: 10px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.check-row input {
    width: 22px;
    height: 22px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
}

.calendar-head {
    text-align: center;
    font-weight: 800;
    color: #64748b;
    padding: 8px 0;
}

.calendar-cell {
    min-height: 110px;
    padding: 12px;
}

.calendar-cell.muted {
    visibility: hidden;
}

.calendar-cell.today {
    outline: 2px solid #ef4444;
    background: #fff7f7;
}

.calendar-day {
    font-weight: 700;
    margin-bottom: 8px;
}

.calendar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    margin-bottom: 6px;
}

.calendar-dot.hw {
    background: #f59e0b;
}

.calendar-dot.sw {
    background: #3b82f6;
}

.calendar-dot.pw {
    background: #8b5cf6;
}

.legend-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    color: var(--muted);
    margin-top: 18px;
    flex-wrap: wrap;
}

.kpi-card {
    padding: 20px;
}

.kpi-card.pass {
    background: #f0fdf4;
}

.kpi-card.fail {
    background: #fff1f2;
}

.kpi-title {
    font-weight: 700;
    color: #4b5563;
    margin-bottom: 12px;
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: #10b981;
}

.kpi-card.fail .kpi-value {
    color: #ef4444;
}

.kpi-target,
.kpi-status {
    margin-top: 10px;
    color: var(--muted);
    font-weight: 700;
}

/* =========================
   TABS / ROWS
========================= */
.tab-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 14px 18px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--line);
    font-weight: 800;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--sidebar-red-light), var(--sidebar-red));
    color: #fff;
    border-color: transparent;
}

.simple-list {
    display: grid;
    gap: 12px;
}

.simple-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: #fff;
}

.simple-row.multi-line {
    align-items: start;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.action-row form {
    margin: 0;
}

/* =========================
   ALERT / EMPTY / FOOTER
========================= */
.alert {
    padding: 14px 16px;
    border-radius: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert.success {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.alert.danger-soft {
    background: #fff1f2;
    color: #be123c;
    border-color: #fecdd3;
}

.empty-state {
    color: var(--muted);
    padding: 8px 0;
}

.site-footer {
    text-align: center;
    color: #8a94a7;
    font-weight: 700;
    padding: 26px 0 36px;
}

/* =========================
   NOTIFICATION
========================= */
.notif-wrapper {
    position: relative;
}

.notif-btn {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    color: #111827;
    padding: 11px 14px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.notif-panel {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 360px;
    max-height: 420px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e6ebf2;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    z-index: 9999;
}

.notif-panel.show {
    display: block;
}

.notif-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #eef2f7;
    background: #f8fafc;
    border-radius: 16px 16px 0 0;
    gap: 10px;
}

.notif-list {
    padding: 8px 0;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f6;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item.unread {
    background: #fff7f7;
}

.notif-message {
    font-size: 14px;
    font-weight: 600;
    color: #1d2a3a;
    line-height: 1.5;
}

.notif-time {
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
}

.notif-empty {
    padding: 18px 16px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.notif-mark-form {
    margin: 0;
}

/* =========================
   LOGIN
========================= */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #7f1d1d, #b91c1c 55%, #dc2626);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-shell {
    width: 100%;
    max-width: 1080px;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, .18);
}

.login-side {
    padding: 48px;
    color: #fff;
    background: linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
}

.login-side h1 {
    margin: 18px 0 10px;
    font-size: 2.2rem;
}

.login-side p {
    margin: 0 0 18px;
    opacity: .92;
}

.login-card {
    background: #fff;
    padding: 42px;
}

.login-card h2 {
    margin: 0 0 8px;
    font-size: 2rem;
}

.login-card p {
    margin: 0 0 22px;
    color: var(--muted);
}

.login-card input[type="text"],
.login-card input[type="email"],
.login-card input[type="password"] {
    height: 50px;
    border: 1px solid #d8e0ec;
    border-radius: 16px;
    background: #ffffff;
}

.login-card input[type="text"]:focus,
.login-card input[type="email"]:focus,
.login-card input[type="password"]:focus {
    border-color: #f87171;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.14);
}

.login-note {
    margin-top: 28px;
    padding: 18px 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .12);
}

.login-note ul {
    margin: 10px 0 0 18px;
    padding: 0;
}

.brand-icon.large {
    width: 74px;
    height: 74px;
    font-size: 34px;
}

/* =========================
   LEGACY ACCOUNT BLOCK
========================= */
.account-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account-meta {
    display: grid;
    gap: 2px;
    color: #fff;
}

.account-meta strong {
    font-size: .95rem;
}

.account-meta span {
    font-size: .8rem;
    opacity: .75;
}

.logout-form {
    margin: 0;
}

.user-pill {
    width: 50px;
    text-align: center;
    border-radius: 999px;
    background: #3b82f6;
    color: #fff;
    padding: 12px 0;
    font-weight: 700;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1400px) {
    .five-up {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .four-up {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .three-up,
    .service-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid.four-up {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content-topbar {
        padding: 16px 20px;
    }

    .page-wrap {
        padding: 20px;
    }
}

@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
    }

    .admin-layout.sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-layout.sidebar-open .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(17, 24, 39, 0.45);
        z-index: 1100;
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-toggle-btn {
        display: inline-grid;
        place-items: center;
    }

    .topbar-account-info {
        display: none;
    }
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-side,
    .login-card {
        padding: 28px;
    }

    .content-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .content-topbar-left,
    .content-topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .content-topbar-right {
        gap: 10px;
    }

    .content-date-pill {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .page-wrap {
        padding: 16px;
    }

    .service-grid,
    .three-up,
    .two-up,
    .five-up,
    .four-up,
    .form-grid.two-up,
    .form-grid.three-up,
    .form-grid.four-up {
        grid-template-columns: 1fr;
    }

    .hero,
    .list-card,
    .simple-row {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: start;
    }

    .calendar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-bar {
        flex-direction: column;
    }

    .notif-panel {
        width: 300px;
        right: -10px;
    }

    .list-side {
        justify-items: start;
    }

    .content-page-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 560px) {
    .admin-sidebar {
        width: 88vw;
        min-width: 88vw;
    }

    .notif-panel {
        width: 280px;
        right: 0;
    }

    .content-topbar-left,
    .content-topbar-right {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .topbar-account-pill,
    .content-date-pill,
    .notif-btn {
        width: 100%;
    }
}
/* =========================
   THAI FONT ENHANCEMENT
========================= */
h1, h2, h3, h4, h5, h6,
.panel-title,
.sidebar-brand-title,
.content-page-title,
.btn,
.badge,
.tag,
.tab-btn,
.settings-tab-btn,
.ticket-service-name,
.ticket-page-intro h2,
.settings-intro h2,
.login-card h2,
.login-side h1 {
    font-family: 'IBM Plex Sans Thai', 'Noto Sans Thai', Tahoma, "Segoe UI", sans-serif;
    letter-spacing: 0.01em;
}

html,
body,
input,
textarea,
select,
button {
    font-family: 'IBM Plex Sans Thai', 'Noto Sans Thai', Tahoma, "Segoe UI", sans-serif;
}

/* =========================================
   BKK GREEN REFINED THEME OVERRIDE
   โทนเขียว กทม. + โครงสร้างดูสะอาดขึ้น
========================================= */
:root {
    --bg: #f4f8f4;
    --panel: #ffffff;
    --panel-soft: #f8f8fc;
    --line: #dad9e7;
    --text: #1a1830;
    --muted: #5f7667;

    --sidebar-red: #28246b;
    --sidebar-red-dark: #1d1a4e;
    --sidebar-red-light: #3d36a2;

    --blue: #36308f;
    --green: #238b45;
    --yellow: #d7a928;
    --orange: #df8d22;
    --purple: #716f8f;
    --pink: #d9597b;
    --danger: #c0392b;

    --shadow: 0 14px 36px rgba(29, 26, 77, 0.08);
    --shadow-soft: 0 8px 20px rgba(29, 26, 77, 0.06);
    --radius: 18px;
    --sidebar-width: 268px;
    --topbar-height: 82px;
}

html, body {
    background: linear-gradient(180deg, #f4f4f8 0%, #efeef6 100%);
    color: var(--text);
}

.admin-sidebar {
    background: linear-gradient(180deg, #413aa8 0%, #312c83 46%, #1d1a4d 100%);
    border-right: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand {
    padding: 8px 8px 16px;
}

.sidebar-brand-icon {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 8px 20px rgba(0,0,0,.08);
}

.sidebar-brand-title {
    font-size: 1.65rem;
}

.sidebar-user-card {
    background: rgba(255,255,255,.11);
    backdrop-filter: blur(8px);
}

.sidebar-link {
    border-radius: 15px;
    padding: 13px 14px;
}

.sidebar-link:hover {
    background: rgba(255,255,255,.12);
    transform: translateX(2px);
}

.sidebar-link.active {
    background: rgba(255,255,255,.16);
    border-color: rgba(255,255,255,.22);
    box-shadow: 0 8px 16px rgba(0,0,0,.07), inset 0 0 0 1px rgba(255,255,255,.06);
}

.sidebar-footer {
    background: rgba(0, 0, 0, 0.10);
}

.sidebar-logout-btn {
    color: #1d1a4d;
}

.content-topbar {
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #dddce8;
    box-shadow: 0 3px 16px rgba(15, 23, 42, 0.03);
}

.content-page-title {
    color: #161436;
}

.content-date-pill,
.topbar-account-pill,
.notification-bell,
.alert-inline,
.search-bar,
.month-switcher .btn,
.btn-light,
.sidebar-toggle-btn {
    border-color: #d8d7e6;
}

.topbar-account-avatar {
    background: linear-gradient(135deg, #3d36a2, #28246b);
}

.page-wrap {
    padding: 22px 24px 28px;
}

.hero,
.panel,
.stat-card,
.service-card,
.type-card,
.list-card,
.pm-card,
.kpi-card,
.simple-row,
.calendar-cell,
.assets-filter-panel,
.assets-list-panel,
.assets-stat-card,
.loan-box,
.ticket-card,
.ticket-view-card {
    border-color: #dddce8 !important;
    box-shadow: 0 8px 22px rgba(29, 26, 77, 0.05) !important;
}

.hero {
    padding: 24px 26px;
}

.hero-gradient,
.hero-yellow,
.hero-blue,
.hero-pink,
.hero-soft {
    background: linear-gradient(135deg, #efeef8 0%, #f9f9fc 100%);
}

.hero h1,
.panel-title,
.section-title,
h2,
h3,
h4 {
    color: #181636;
}

.panel {
    padding: 20px;
}

.cards-grid {
    gap: 16px;
}

.stat-card,
.assets-stat-card {
    position: relative;
    overflow: hidden;
    background: #fff;
}

.stat-card::before,
.assets-stat-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, #413aa8, #938fd1);
}

.stat-title,
.assets-stat-title {
    color: #474563;
}

.stat-number,
.assets-stat-number {
    color: #181636;
}

.type-card,
.service-card,
.pm-card,
.kpi-card,
.list-card,
.simple-row {
    background: #ffffff;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #d0cfe0;
    background: #ffffff;
    border-radius: 14px;
    padding: 12px 14px;
    color: #1a1830;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #36308f;
    box-shadow: 0 0 0 4px rgba(54, 48, 143, 0.12);
    background: #fdfdfe;
}

label {
    display: inline-block;
    margin-bottom: 6px;
    color: #292748;
    font-weight: 700;
}

.btn {
    border-radius: 14px;
    font-weight: 800;
    padding: 11px 16px;
    transition: all .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary,
button[type="submit"].btn-primary {
    background: linear-gradient(135deg, #36308f, #28246b);
    border: 1px solid transparent;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(40, 36, 107, 0.18);
}

.btn-primary:hover,
button[type="submit"].btn-primary:hover {
    filter: brightness(1.03);
    box-shadow: 0 10px 22px rgba(40, 36, 107, 0.22);
}

.btn-light {
    background: #ffffff;
    color: #222044;
    border: 1px solid #d4d3e3;
}

.btn-light:hover {
    background: #f7f7fb;
}

.btn-danger {
    background: linear-gradient(135deg, #d95c4d, #bf3d31);
    color: #fff;
    border: 0;
}

.badge,
.status-pill,
.small-badge {
    border-radius: 999px;
    font-weight: 800;
}

.badge.success,
.status-complete,
.status-success {
    background: #e1e0f5 !important;
    color: #272266 !important;
}

.badge.info,
.status-open,
.status-waiting {
    background: #e3e2f2 !important;
    color: #28246b !important;
}

.badge.warning,
.status-progress {
    background: #fff3d9 !important;
    color: #a96d00 !important;
}

.badge.danger,
.status-cancel,
.status-overdue {
    background: #ffe3df !important;
    color: #b63a2b !important;
}

.tag,
.views,
.content-breadcrumb,
.assets-sub,
.muted,
.helper-text,
.form-hint,
.empty-state,
.list-content p,
.panel p {
    color: #627768;
}

.search-bar {
    display: flex;
    gap: 12px;
    align-items: stretch;
    flex-wrap: wrap;
    background: #ffffff;
    padding: 0;
}

.search-bar input {
    flex: 1;
    min-width: 240px;
}

.table-wrap,
.assets-table-wrap {
    border: 1px solid #dddce8;
    border-radius: 16px;
    overflow: auto;
}

.table,
.assets-table {
    background: #fff;
}

.table th,
.table td,
.assets-table th,
.assets-table td {
    border-bottom: 1px solid #e4e3ec;
}

.table th,
.assets-table th {
    background: #f6f6fb;
    color: #4d4b63;
    font-weight: 800;
}

.table tr:hover td,
.assets-row:hover td {
    background: #fbfbfe;
}

.calendar-head {
    color: #2f2d4d;
    font-weight: 800;
}

.calendar-cell.today {
    border-color: #3d36a2;
    box-shadow: inset 0 0 0 1px rgba(61, 54, 162, 0.16);
    background: #f4f3fb;
}

.calendar-dot.hw { background: #dd8e1b; }
.calendar-dot.sw { background: #3d36a1; }
.calendar-dot.pw { background: #8d76d9; }

.login-body {
    background: linear-gradient(135deg, #28246b 0%, #36308f 42%, #dddcef 100%);
}

.login-shell {
    gap: 0;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(29, 26, 77, 0.20);
}

.login-side {
    background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
}

.login-card {
    background: rgba(255,255,255,.96);
}

.notification-bell,
.notification-chip {
    background: #ffffff;
}

.progress,
.progress-track,
.meter,
.progress-bar-bg {
    background: #e8e7ef;
    border-radius: 999px;
}

.progress-fill,
.meter-fill,
.progress-bar-fill {
    background: linear-gradient(90deg, #413aa8, #28246b);
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.stack-gap {
    display: grid;
    gap: 16px;
}

.list-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    align-items: start;
    padding: 18px 20px;
}

.list-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: #efeef7;
}

.list-side {
    display: grid;
    gap: 10px;
    justify-items: end;
}

.pm-head,
.ticket-head,
.asset-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 1200px) {
    :root {
        --sidebar-width: 250px;
    }
}

@media (max-width: 992px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.25);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
        z-index: 1100;
    }

    .sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-toggle-btn {
        display: inline-grid;
        place-items: center;
    }

    .page-wrap {
        padding: 18px;
    }

    .five-up,
    .four-up,
    .three-up,
    .two-up,
    .assets-stats-grid,
    .cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .content-topbar {
        padding: 14px 16px;
    }

    .content-page-title {
        font-size: 1.28rem;
    }

    .page-wrap {
        padding: 16px;
    }

    .hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }

    .five-up,
    .four-up,
    .three-up,
    .two-up,
    .assets-stats-grid,
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .list-card {
        grid-template-columns: 1fr;
    }

    .list-side {
        justify-items: start;
    }

    .assets-list-head,
    .assets-list-topbar,
    .content-topbar,
    .content-topbar-right,
    .content-topbar-left {
        align-items: flex-start;
    }
}

/* ========================================
   PASTEL GREEN GRAPH OVERRIDE
   เขียวพาสเทลนุ่มตา สำหรับกราฟ / progress / bar
======================================== */

/* พื้นหลังแถบกราฟ */
.progress,
.bar,
.rank-item .progress,
.rank-item .bar,
.performance-card .progress,
.type-card .progress,
.type-card-admin .progress {
    background: #e5e4f1 !important;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(47, 44, 94, 0.05);
}

/* ตัวแถบกราฟหลัก */
.progress span,
.bar span,
.rank-item .progress span,
.rank-item .bar span,
.performance-card .progress span,
.type-card .progress span,
.type-card-admin .progress span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        #dad9f2 0%,
        #bab7e4 30%,
        #9995d5 60%,
        #7974c6 82%,
        #5952b7 100%
    ) !important;
    box-shadow: 0 1px 3px rgba(89, 82, 183, 0.18);
}

/* แถบในส่วน performance */
.performance-card .progress span {
    background: linear-gradient(
        90deg,
        #e2e0f5 0%,
        #c1bee8 28%,
        #948fd3 60%,
        #6e68bf 82%,
        #454091 100%
    ) !important;
}

/* แถบในกลุ่ม rank list */
.rank-item .progress span,
.rank-item .bar span {
    background: linear-gradient(
        90deg,
        #e5e4f6 0%,
        #cac8ed 30%,
        #a39fdd 65%,
        #7974c6 100%
    ) !important;
}

/* แถบในกลุ่มประเภท HW / SW / PW */
.type-card .progress span,
.type-card-admin .progress span {
    background: linear-gradient(
        90deg,
        #e4e3f6 0%,
        #cfcdee 32%,
        #aeaadf 65%,
        #847fcc 100%
    ) !important;
}

/* ความสูงแถบหลัก */
.progress,
.bar {
    height: 10px;
}

/* ความสูงแถบแบบบาง */
.progress.slim,
.bar.slim,
.rank-item .progress.slim,
.rank-item .bar.slim {
    height: 8px;
}

/* ปุ่มกรอง HW / SW / PW */
.dashboard-filter-chip.active {
    background: linear-gradient(135deg, #9995d5, #5952b7) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 6px 14px rgba(89, 82, 183, 0.18);
}

/* เส้นขอบการ์ดที่ active */
.type-card-admin.active {
    outline: 2px solid #7974c6 !important;
}

/* เลข ticket ให้เข้ากับธีมเขียว */
.ticket-code {
    color: #312d6a !important;
}
/* =========================================
   SIDEBAR BRAND LOGO LAYOUT OVERRIDE
========================================= */
.sidebar-brand {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 0 !important;
    padding: 20px 14px 22px !important;
    margin-bottom: 14px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
}

.sidebar-brand-logo-wrap {
    width: 92px;
    height: 92px;
    border-radius: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(4px);
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-brand-logo {
    width: 68px;
    height: 68px;
    object-fit: contain;
    display: block;
}

.sidebar-brand-fallback {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    background: rgba(255,255,255,0.16);
    color: #ffffff;
}

.sidebar-brand-text {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100%;
}

.sidebar-brand-title {
    margin: 0 !important;
    font-size: 1.9rem !important;
    font-weight: 800 !important;
    line-height: 1.03 !important;
    letter-spacing: -0.02em !important;
    color: #ffffff !important;
    max-width: 180px;
    word-break: break-word;
    text-shadow: 0 1px 2px rgba(0,0,0,0.10);
}

.sidebar-brand-subtitle {
    margin: 0 !important;
    font-size: 0.98rem !important;
    line-height: 1.4 !important;
    font-weight: 700 !important;
    color: rgba(255,255,255,0.94) !important;
    max-width: 190px;
}

@media (max-width: 768px) {
    .sidebar-brand {
        padding: 18px 12px 20px !important;
    }

    .sidebar-brand-logo-wrap {
        width: 80px;
        height: 80px;
        border-radius: 22px;
    }

    .sidebar-brand-logo {
        width: 58px;
        height: 58px;
    }

    .sidebar-brand-title {
        font-size: 1.65rem !important;
        max-width: 165px;
    }

    .sidebar-brand-subtitle {
        font-size: 0.9rem !important;
        max-width: 170px;
    }
}
