/* =====================================================================
   app.css — Gaya tampilan Klinik Hewan (tanpa dependensi eksternal)
   Ditulis manual agar aplikasi tetap berjalan tanpa internet.
   ===================================================================== */

:root {
    --bg:            #f1f5f9;
    --surface:       #ffffff;
    --surface-2:     #f8fafc;
    --border:        #e2e8f0;
    --text:          #0f172a;
    --text-soft:     #64748b;
    --primary:       #059669;
    --primary-dark:  #047857;
    --primary-soft:  #ecfdf5;
    --blue:          #2563eb;
    --blue-soft:     #eff6ff;
    --amber:         #d97706;
    --amber-soft:    #fffbeb;
    --red:           #dc2626;
    --red-soft:      #fef2f2;
    --violet:        #7c3aed;
    --violet-soft:   #f5f3ff;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-lg:     0 10px 30px rgba(15, 23, 42, .12);
    --sidebar-w:     248px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================ LAYOUT ============================ */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: #0f172a;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar__brand {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar__brand strong {
    display: block;
    color: #fff;
    font-size: 17px;
    letter-spacing: .2px;
}
.sidebar__brand span { font-size: 12px; color: #94a3b8; }

.sidebar__nav { padding: 12px 10px; flex: 1; }
.sidebar__group {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
    padding: 14px 10px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 14px;
    margin-bottom: 2px;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-link__icon { width: 20px; text-align: center; }

.sidebar__foot {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: 13px;
}
.sidebar__user { color: #fff; font-weight: 600; }
.sidebar__role { color: #94a3b8; font-size: 12px; margin-bottom: 8px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 26px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar__title { font-size: 19px; font-weight: 700; margin: 0; }
.topbar__sub { font-size: 13px; color: var(--text-soft); margin: 2px 0 0; }
.topbar__actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.content { padding: 22px 26px 60px; flex: 1; }

/* ============================ CARD ============================ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}
.card__head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.card__title { font-size: 15px; font-weight: 700; margin: 0; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* Kartu statistik */
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat__label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-soft);
    font-weight: 600;
}
.stat__value { font-size: 26px; font-weight: 700; margin: 6px 0 2px; }
.stat__hint { font-size: 12px; color: var(--text-soft); }
.stat--primary { border-left: 4px solid var(--primary); }
.stat--blue    { border-left: 4px solid var(--blue); }
.stat--amber   { border-left: 4px solid var(--amber); }
.stat--red     { border-left: 4px solid var(--red); }

/* ============================ TABEL ============================ */

.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table.data th {
    text-align: left;
    padding: 11px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-soft);
    white-space: nowrap;
}
table.data td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
.table-empty { padding: 34px 18px; text-align: center; color: var(--text-soft); }

/* ============================ BADGE ============================ */

.badge {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}
.badge--scheduled { background: var(--blue-soft); color: #1d4ed8; }
.badge--arrived   { background: var(--violet-soft); color: #6d28d9; }
.badge--exam      { background: var(--amber-soft); color: #b45309; }
.badge--completed { background: var(--primary-soft); color: var(--primary-dark); }
.badge--cancelled { background: var(--red-soft); color: var(--red); }
.badge--unpaid    { background: var(--amber-soft); color: #b45309; }
.badge--paid      { background: var(--primary-soft); color: var(--primary-dark); }
.badge--low       { background: var(--red-soft); color: var(--red); }
.badge--neutral   { background: #f1f5f9; color: #475569; }

/* ============================ TOMBOL ============================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn--blue:hover { filter: brightness(.93); }
.btn--danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn--danger:hover { filter: brightness(.93); }
.btn--ghost { background: transparent; }
.btn--sm { padding: 5px 10px; font-size: 12.5px; }
.btn--block { width: 100%; }

/* ============================ FORM ============================ */

.field { margin-bottom: 14px; }
.field label,
.label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #334155;
}
.field .hint { font-size: 12px; color: var(--text-soft); margin-top: 4px; }
.req::after { content: " *"; color: var(--red); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="tel"], input[type="search"],
select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, .14);
}
textarea { min-height: 84px; resize: vertical; }

.form-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    margin-top: 18px;
    padding-top: 16px;
    flex-wrap: wrap;
}
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: auto; }

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 16px;
}
.toolbar .field { margin-bottom: 0; min-width: 160px; }

/* ============================ SOAP ============================ */

.soap-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.soap-box { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.soap-box__head {
    padding: 8px 12px;
    background: var(--surface-2);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--text-soft);
    border-bottom: 1px solid var(--border);
}
.soap-box textarea {
    border: none;
    border-radius: 0;
    min-height: 130px;
}
.soap-box textarea:focus { box-shadow: none; }

/* ============================ MODAL ============================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    z-index: 100;
}
.modal-backdrop.is-open { display: flex; }
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 720px;
}
.modal__head {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal__title { font-size: 16px; font-weight: 700; margin: 0; }
.modal__body { padding: 20px; max-height: 66vh; overflow-y: auto; }
.modal__foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.modal__close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-soft);
}

/* ============================ TOAST ============================ */

.toast-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
    max-width: min(360px, calc(100vw - 36px));
}
.toast {
    background: #0f172a;
    color: #fff;
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: toast-in .18s ease-out;
}
.toast--success { background: #065f46; }
.toast--error   { background: #991b1b; }
.toast--info    { background: #1e3a8a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================ LOGIN ============================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(140deg, #064e3b 0%, #0f172a 100%);
}
.login-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 30px 28px;
}
.login-card__logo { font-size: 40px; text-align: center; }
.login-card h1 { font-size: 21px; text-align: center; margin: 6px 0 2px; }
.login-card p.sub { text-align: center; color: var(--text-soft); font-size: 13.5px; margin: 0 0 22px; }
.demo-accounts {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-soft);
}
.demo-accounts table { width: 100%; border-collapse: collapse; }
.demo-accounts td { padding: 3px 0; }
.demo-accounts code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ============================ LAIN-LAIN ============================ */

.page-alert {
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.page-alert--error { background: var(--red-soft); color: #991b1b; border-color: #fecaca; }
.page-alert--info  { background: var(--blue-soft); color: #1e40af; border-color: #bfdbfe; }

.muted { color: var(--text-soft); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 13px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-select { max-width: 170px; padding: 4px 8px; font-size: 12.5px; }

.appt-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    margin-bottom: 10px;
}
.appt-item__time {
    font-weight: 700;
    color: var(--blue);
    font-size: 13.5px;
    white-space: nowrap;
}
.appt-item__name { font-weight: 700; font-size: 15px; }
.appt-item__meta { font-size: 12.5px; color: var(--text-soft); }

.mini-chart { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding: 4px 2px; }
.mini-chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; justify-content: flex-end; }
.mini-chart__bar {
    width: 100%;
    max-width: 46px;
    background: var(--primary);
    border-radius: 5px 5px 0 0;
    min-height: 4px;
    transition: height .3s;
}
.mini-chart__label { font-size: 11px; color: var(--text-soft); }
.mini-chart__val { font-size: 12px; font-weight: 700; }

/* ============================ CETAK NOTA ============================ */

@media print {
    .sidebar, .topbar__actions, .no-print { display: none !important; }
    .layout, .main { display: block; }
    .content { padding: 0; }
    .card { box-shadow: none; border: none; }
    body { background: #fff; }
}

/* ============================ RESPONSIF ============================ */

@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; }
    .sidebar__nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .sidebar__group { display: none; }
    .nav-link { margin-bottom: 0; }
    .content, .topbar { padding-left: 16px; padding-right: 16px; }
}
