/* ===================================================================== *
 * Pearl Tex — Shared Theme
 * Bold, professional GREEN & WHITE. Used across every page.
 * ===================================================================== */
:root {
    --green: #0a8a4f;
    --green-dark: #076b3c;
    --green-darker: #05512d;
    --green-tint: #e9f6ef;
    --green-tint-2: #d7eede;
    --ink: #11241a;
    --muted: #5d6f66;
    --bg: #f4f8f5;
    --white: #ffffff;
    --border: #d8e6dd;
    --danger: #c0392b;
    --danger-bg: #fcecec;
    --shadow-sm: 0 4px 14px rgba(7, 107, 60, 0.06);
    --shadow-md: 0 16px 40px rgba(7, 107, 60, 0.14);
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

/* ----------------------------- Brand / logo ---------------------------- */
.brand { display: flex; align-items: center; gap: 11px; }
.brand .logo-icon {
    width: 30px; height: 30px;
    flex: none;
    color: var(--green);
}
.brand .logo-text {
    font-weight: 800;
    font-size: 21px;
    letter-spacing: -0.4px;
    color: var(--ink);
}
.brand .logo-accent { color: var(--green); }
.brand.on-dark .logo-text { color: #fff; }
.brand.on-dark .logo-icon { color: #fff; }
.brand.on-dark .logo-accent { color: #b9f0d2; }

/* ----------------------------- Top bar --------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 38px;
    height: 68px;
    background: var(--white);
    border-bottom: 2px solid var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 18px; }

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--green);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
}
.user-name { font-size: 14px; font-weight: 600; color: var(--ink); }

.btn-ghost {
    display: inline-flex; align-items: center; gap: 7px;
    color: var(--green-dark);
    text-decoration: none;
    font-size: 13.5px; font-weight: 600;
    border: 1.5px solid var(--border);
    padding: 8px 15px; border-radius: 9px;
    background: var(--white);
    transition: border-color .15s, color .15s, background .15s;
    cursor: pointer;
}
.btn-ghost:hover { border-color: var(--green); color: var(--green); background: var(--green-tint); }
.btn-ghost svg { width: 16px; height: 16px; }

.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    padding: 13px 16px;
    border: none; border-radius: 10px;
    background: var(--green);
    color: #fff;
    font-size: 15px; font-weight: 700; font-family: inherit;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:active { transform: translateY(1px); }

/* ----------------------------- Keyboard key ---------------------------- */
.kbd {
    display: inline-block; min-width: 18px; text-align: center;
    font-size: 11px; font-weight: 700; font-family: inherit;
    color: var(--muted); background: var(--bg);
    border: 1px solid var(--border); border-bottom-width: 2px;
    border-radius: 5px; padding: 1px 6px; line-height: 1.5;
}

/* ----------------------- Appbar search + help -------------------------- */
.appbar-search {
    display: inline-flex; align-items: center; gap: 9px;
    min-width: 230px;
    padding: 8px 10px 8px 12px; border-radius: 10px;
    border: 1.5px solid var(--border); background: var(--bg);
    color: var(--muted); cursor: pointer; font-family: inherit; font-size: 13.5px;
    transition: border-color .15s, background .15s;
}
.appbar-search:hover { border-color: var(--green); background: var(--white); }
.appbar-search svg { width: 16px; height: 16px; flex: none; }
.appbar-search-text { flex: 1; text-align: left; }
.appbar-help {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 9px;
    border: 1.5px solid var(--border); background: var(--white);
    color: var(--muted); cursor: pointer; transition: all .15s;
}
.appbar-help:hover, .appbar-help.active { border-color: var(--green); color: var(--green); background: var(--green-tint); }
.appbar-help { text-decoration: none; }
.appbar-help svg { width: 18px; height: 18px; }

@media (max-width: 720px) {
    .appbar-search { min-width: 0; }
    .appbar-search-text, .appbar-search .kbd { display: none; }
}

/* ----------------------- Command palette ------------------------------- */
.palette-overlay {
    position: fixed; inset: 0; z-index: 120;
    background: rgba(17, 36, 26, 0.45);
    display: none; align-items: flex-start; justify-content: center;
    padding: 12vh 16px 16px;
}
.palette-overlay.open { display: flex; }
.palette {
    width: 100%; max-width: 600px;
    background: var(--white); border-radius: 16px;
    box-shadow: var(--shadow-md); overflow: hidden;
    animation: modal-pop .16s ease;
}
.palette-input-wrap {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 18px; border-bottom: 1.5px solid var(--border);
}
.palette-input-wrap svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.palette-input-wrap input {
    flex: 1; border: none; outline: none; font-size: 16px;
    font-family: inherit; color: var(--ink); background: none;
}
.palette-results { max-height: 50vh; overflow-y: auto; padding: 8px; }
.palette-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; border-radius: 10px; text-decoration: none;
    color: var(--ink); cursor: pointer;
}
.palette-item.active { background: var(--green-tint); }
.palette-type {
    flex: none; font-size: 11px; font-weight: 800; text-transform: uppercase;
    letter-spacing: .4px; color: var(--green-dark);
    background: var(--green-tint-2); padding: 3px 8px; border-radius: 6px; min-width: 84px; text-align: center;
}
.palette-item.active .palette-type { background: var(--green); color: #fff; }
.palette-main { display: flex; flex-direction: column; min-width: 0; }
.palette-title { font-size: 14.5px; font-weight: 600; }
.palette-sub { font-size: 12.5px; color: var(--muted); }
.palette-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }
.palette-foot {
    display: flex; gap: 18px; padding: 10px 18px;
    border-top: 1.5px solid var(--border); background: #fafcfb;
    font-size: 12px; color: var(--muted);
}
.palette-foot .kbd { margin-right: 3px; }

/* ----------------------- Shortcuts help table -------------------------- */
.shortcut-table { width: 100%; border-collapse: collapse; }
.shortcut-table td { padding: 9px 4px; font-size: 14px; border-bottom: 1px solid var(--border); }
.shortcut-table tr:last-child td { border-bottom: none; }
.shortcut-table td:first-child { width: 46%; white-space: nowrap; }
.shortcut-table .kbd { margin-right: 3px; }

/* ----------------------- Table quick-filter ---------------------------- */
.table-filter {
    display: inline-flex; align-items: center; gap: 8px;
    border: 1.5px solid var(--border); border-radius: 9px;
    padding: 6px 11px; background: var(--bg);
}
.table-filter svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.table-filter input {
    border: none; outline: none; background: none; font-family: inherit;
    font-size: 13.5px; color: var(--ink); width: 180px;
}
