:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #166534;
    --primary-soft: #dcfce7;
    --border: #e5e7eb;
    --danger: #b91c1c;
    --warning: #b45309;
    --success: #166534;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}

.auth-hero {
    padding: 48px;
    background: linear-gradient(140deg, #14532d, #15803d);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
}

.auth-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.03);
}

.auth-card {
    width: 100%;
    max-width: 430px;
    padding: 28px;
}

label {
    font-size: 13px;
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #86efac;
    border-color: #4ade80;
}

button,
.btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-outline {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

.flash {
    padding: 11px 12px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
}

.flash-success {
    background: #dcfce7;
    color: #166534;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.app-shell {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(170deg, #0f172a, #1f2937);
    color: #f8fafc;
    padding: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand h1 {
    margin: 0;
    font-size: 20px;
}

.brand p {
    margin: 6px 0 0;
    color: #cbd5e1;
    font-size: 12px;
}

.menu {
    margin-top: 20px;
}

.menu-group {
    margin-bottom: 14px;
}

.menu-title {
    font-size: 11px;
    color: #94a3b8;
    letter-spacing: 0.04em;
    margin: 0 0 6px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.menu-title-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.menu-title.active {
    color: #cbd5e1;
}

.menu-title.active .menu-icon {
    color: #cbd5e1;
}

.menu-group-collapsible summary {
    cursor: pointer;
    list-style: none;
}

.menu-group-collapsible summary::-webkit-details-marker {
    display: none;
}

.menu-chevron {
    width: 14px;
    height: 14px;
    display: inline-flex;
    color: #94a3b8;
    transition: transform 0.2s ease, color 0.2s ease;
}

.menu-chevron svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.menu-group-collapsible[open] .menu-chevron {
    transform: rotate(90deg);
    color: #cbd5e1;
}

.submenu {
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid rgba(148, 163, 184, 0.3);
    display: grid;
    gap: 4px;
}

.submenu .menu-link {
    font-size: 13px;
    padding: 8px 10px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 10px;
    font-size: 14px;
    color: #e2e8f0;
}

.menu-text {
    line-height: 1.2;
}

.menu-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #cbd5e1;
}

.menu-title .menu-icon {
    width: 14px;
    height: 14px;
    color: #94a3b8;
}

.menu-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.menu-link:hover,
.menu-link.active {
    background: rgba(255, 255, 255, 0.14);
}

.menu-link:hover .menu-icon,
.menu-link.active .menu-icon {
    color: #f8fafc;
}

.main {
    padding: 20px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-card {
    padding: 10px 12px;
}

.topbar-notification {
    min-width: 220px;
}

.topbar-title {
    font-size: 22px;
    margin: 0;
}

.muted {
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 14px;
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.stat {
    padding: 15px;
}

.stat p {
    margin: 0;
}

.stat .label {
    color: var(--muted);
    font-size: 13px;
}

.stat .value {
    margin-top: 6px;
    font-size: 24px;
    font-weight: 700;
}

.section {
    padding: 18px;
}

.section + .section {
    margin-top: 14px;
}

.section h3 {
    margin: 0 0 12px;
    font-size: 17px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    border-bottom: 1px solid var(--border);
    padding: 10px;
    vertical-align: top;
    font-size: 14px;
}

th {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #e0f2fe;
    color: #075985;
}

.list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.list li:last-child {
    border-bottom: 0;
}

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

.calendar-topbar {
    align-items: flex-start;
}

.calendar-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.calendar-layout {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    align-items: flex-start;
}

.calendar-board {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #fbfdfc;
}

.calendar-weekdays,
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.calendar-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--muted);
    text-transform: uppercase;
}

.calendar-day {
    position: relative;
    min-height: 84px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.calendar-day:hover {
    border-color: #86efac;
    box-shadow: 0 4px 14px rgba(22, 101, 52, 0.12);
    transform: translateY(-1px);
}

.calendar-day-number {
    font-size: 15px;
    font-weight: 700;
}

.calendar-day-dot {
    position: absolute;
    left: 8px;
    bottom: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
}

.calendar-day-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    color: #065f46;
    background: #d1fae5;
    border-radius: 999px;
    padding: 2px 8px;
}

.calendar-day.is-outside {
    opacity: 0.5;
}

.calendar-day.is-today {
    border-color: #4ade80;
}

.calendar-day.is-selected {
    border-color: #166534;
    background: var(--primary-soft);
    box-shadow: 0 0 0 2px rgba(22, 101, 52, 0.2);
}

.calendar-selected {
    height: 100%;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-master-form {
    display: grid;
    grid-template-columns: 1fr 180px auto;
    gap: 8px;
    margin: 12px 0 16px;
}

.settings-row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-inline-form {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 320px;
}

.settings-kode-input {
    max-width: 120px;
}

.chart-bar {
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
    margin-top: 6px;
}

.chart-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #15803d, #16a34a);
}

.public-header {
    background: linear-gradient(140deg, #166534, #22c55e);
    color: #fff;
    padding: 30px 16px;
}

.public-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px;
}

.public-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.product-card {
    padding: 14px;
}

.error-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 20px;
}

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

    .sidebar {
        height: auto;
        position: static;
    }

    .auth-layout {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        display: none;
    }

    .calendar-layout {
        grid-template-columns: 1fr;
    }

    .calendar-day {
        min-height: 70px;
    }

    .calendar-nav {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .sidebar {
        height: auto;
        max-height: none;
        padding: 16px;
    }

    .main {
        padding: 14px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .topbar-meta {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 10px;
    }

    .topbar-card {
        width: 100%;
    }

    .topbar-notification {
        min-width: 0;
    }

    .row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .section,
    .stat,
    .product-card {
        padding: 14px;
    }

    .form-actions .btn {
        width: 100%;
    }

    .table-actions {
        flex-direction: column;
    }

    .table-actions > .btn,
    .table-actions > form,
    .table-actions form .btn {
        width: 100%;
    }

    .settings-master-form {
        grid-template-columns: 1fr;
    }

    .settings-inline-form {
        min-width: 100%;
        flex-wrap: wrap;
    }

    .settings-kode-input {
        max-width: none;
    }
}
