/* global.css — KuikAR design system
   Minimalist / classic with a glass touch. White, black and deep teal. */

:root {
    /* Surfaces */
    --bg: #f4f7f6;
    --bg-soft: #e9f0ee;
    --card-bg: rgba(255, 255, 255, 0.74);
    --card-solid: #ffffff;
    --glass-strong: rgba(255, 255, 255, 0.88);
    --glass-border: rgba(255, 255, 255, 0.7);

    /* Ink */
    --text: #121a18;
    --text-muted: #5c6b67;

    /* Teals */
    --teal-900: #08211d;
    --teal-800: #0b2f29;
    --teal-700: #0e4038;
    --teal-600: #0e5d52;
    --teal-500: #1a7264;
    --teal-300: #7cc4b8;
    --teal-200: #b9dfd8;
    --teal-100: #e3f1ee;

    /* Semantic */
    --primary: #0e5d52;
    --primary-hover: #0a4a41;
    --button-bg: #0e5d52;
    --accent: #1f8a7a;
    --danger: #b23b32;
    --success: #2f7d5a;
    --warning: #b07a24;

    /* Structure */
    --border: rgba(16, 58, 52, 0.14);
    --shadow: 0 10px 26px rgba(10, 36, 32, 0.08);
    --shadow-lg: 0 20px 48px rgba(8, 30, 27, 0.16);
    --radius: 16px;
    --radius-sm: 10px;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font);
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg);
    background-image:
        radial-gradient(1000px 560px at 90% -10%, rgba(31, 138, 122, 0.10), transparent 62%),
        radial-gradient(820px 480px at -10% 108%, rgba(14, 93, 82, 0.08), transparent 60%);
    background-repeat: no-repeat;
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

h3 { font-size: 17px; }
h4 { font-size: 15px; }

a { color: var(--primary); }

p { line-height: 1.55; }

code {
    background: var(--teal-100);
    color: var(--teal-800);
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.9em;
}

::selection { background: rgba(14, 93, 82, 0.22); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(14, 93, 82, 0.3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(14, 93, 82, 0.24); border-radius: 999px; }

/* =========================================
   Dark mode
   ========================================= */
body.dark-mode {
    --bg: #1b2421;
    --bg-soft: #222d29;
    --card-bg: rgba(36, 47, 43, 0.74);
    --card-solid: #27322f;
    --glass-strong: rgba(36, 48, 43, 0.9);
    --glass-border: rgba(190, 214, 208, 0.14);
    --text: #eef4f2;
    --text-muted: #a3b5b0;
    --primary: #5fc0af;
    --primary-hover: #74cfc0;
    --button-bg: #15796a;
    --border: rgba(190, 214, 208, 0.16);
    --shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);
    background-image:
        radial-gradient(1000px 560px at 90% -10%, rgba(46, 160, 143, 0.14), transparent 62%),
        radial-gradient(820px 480px at -10% 108%, rgba(31, 112, 98, 0.12), transparent 60%);
}

/* =========================================
   Utilities
   ========================================= */
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.p-4 { padding: 1rem; }
.mt-4 { margin-top: 1rem; }
.w-full { width: 100%; }

/* =========================================
   Cards
   ========================================= */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 20px;
}

body.dark-mode .card {
    border-color: var(--border);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.card-head h3 { margin-bottom: 0; }

/* Inline dialogs that still use the old inline card background get the
   glass treatment too. */
div[style*="background: var(--card-bg)"],
div[style*="background:var(--card-bg)"] {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.page-head { margin-bottom: 22px; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.page-head .muted { margin-top: 4px; font-size: 14px; }

/* =========================================
   Buttons
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--glass-strong);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { background: var(--teal-100); }
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn.primary {
    background: var(--button-bg);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(8, 36, 32, 0.22);
}

.btn.primary:hover { background: var(--primary-hover); filter: none; }

.btn.ghost {
    background: transparent;
    border-color: var(--border);
}
.btn.ghost:hover { background: rgba(14, 93, 82, 0.07); }

.btn.danger {
    background: rgba(163, 58, 50, 0.08);
    color: var(--danger);
    border-color: rgba(163, 58, 50, 0.3);
}
.btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn.sm { min-height: 30px; padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }

body.dark-mode .btn { background: rgba(255, 255, 255, 0.06); }
body.dark-mode .btn:hover { background: rgba(255, 255, 255, 0.12); }
body.dark-mode .btn.ghost:hover { background: rgba(255, 255, 255, 0.08); }
body.dark-mode .btn.primary { background: var(--button-bg); }
body.dark-mode .btn.primary:hover { background: #106557; }

/* Legacy button labels keep working */
button[type="submit"],
.checkout-btn,
.login-btn {
    background-color: var(--button-bg, #6b4a2b);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 14.5px;
    padding: 11px 16px;
    transition: background-color 0.18s ease, filter 0.18s ease, transform 0.1s ease;
}

button[type="submit"]:hover,
.checkout-btn:hover {
    background-color: var(--primary-hover);
    filter: none;
}

body.dark-mode button[type="submit"]:hover { background-color: #106557; }

button[type="submit"]:active { transform: scale(0.98); }
button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; }

button[type="button"]:not(.user-menu-btn):not(.user-menu-item) {
    min-height: 40px;
    background-color: rgba(14, 93, 82, 0.07);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    padding: 9px 16px;
    transition: background-color 0.18s ease, transform 0.1s ease;
}

button[type="button"]:not(.user-menu-btn):not(.user-menu-item):hover { background-color: rgba(14, 93, 82, 0.14); }
button[type="button"]:not(.user-menu-btn):not(.user-menu-item):active { transform: scale(0.985); }

body.dark-mode button[type="button"]:not(.user-menu-btn):not(.user-menu-item) { background-color: rgba(255, 255, 255, 0.06); }
body.dark-mode button[type="button"]:not(.user-menu-btn):not(.user-menu-item):hover { background-color: rgba(255, 255, 255, 0.12); }

.icon-btn {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.icon-btn:hover {
    background: rgba(14, 93, 82, 0.07);
    border-color: var(--border);
    color: var(--text);
}

/* =========================================
   Forms
   ========================================= */
.mop-select,
.login-input,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: rgba(0, 0, 0, 0.22);
}

input::placeholder,
textarea::placeholder { color: var(--text-muted); opacity: 0.8; }

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 93, 82, 0.12);
    background: var(--card-solid);
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 0 3px rgba(95, 192, 175, 0.2);
}

input[type="file"] { padding: 8px 10px; font-size: 13px; }

textarea { resize: vertical; line-height: 1.5; }

input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--button-bg);
}

label { color: var(--text); font-size: 14px; }

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.stack-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.stack-form label input,
.stack-form label select,
.stack-form label textarea {
    font-weight: 400;
    color: var(--text);
}

.inline-form {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.inline-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* =========================================
   Tables
   ========================================= */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 10px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr { transition: background 0.15s ease; }
.data-table tbody tr:hover { background: rgba(14, 93, 82, 0.04); }
body.dark-mode .data-table tbody tr:hover { background: rgba(255, 255, 255, 0.04); }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-wrap table { min-width: 0; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: 0.02em;
}
.badge.ok { background: rgba(79, 122, 82, 0.14); color: var(--success); }
.badge.off { background: rgba(163, 58, 50, 0.12); color: var(--danger); }

.row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}

.inline-group {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.inline-group input {
    padding: 6px 8px;
    font-size: 12.5px;
    border-radius: 8px;
}

/* =========================================
   Modal dialog (shared)
   ========================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 18, 16, 0.55);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 18px;
}

.modal-card {
    background: var(--glass-strong);
    backdrop-filter: blur(26px) saturate(1.2);
    -webkit-backdrop-filter: blur(26px) saturate(1.2);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 24px;
    width: 460px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    color: var(--text);
}

body.dark-mode .modal-card { border-color: var(--border); }

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* =========================================
   Footer
   ========================================= */
.app-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 36px;
    padding: 20px 0 8px;
    border-top: 1px solid var(--border);
}

.app-footer-links {
    display: flex;
    gap: 8px 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.app-footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    opacity: 0.9;
}

.app-footer-links a:hover { text-decoration: underline; }

.app-footer-copy {
    color: var(--text-muted);
    font-size: 12px;
    margin: 0;
}
