/* ============================================================================
   Innovative Shop Portal — base styles
   Tokens follow the First Piece app's visual language for continuity.
   ============================================================================ */

:root {
    --bg:             #0f1419;
    --bg-elev:        #161c24;
    --bg-card:        #1a222c;
    --bg-card-hover:  #222c38;
    --border:         #2a3441;
    --border-strong:  #3a4655;

    --ink:            #e6edf3;
    --ink-muted:      #94a3b8;
    --ink-dim:        #64748b;

    --accent:         #f97316;   /* warm industrial orange */
    --accent-hover:   #fb923c;
    --accent-ink:     #ffffff;

    --info:           #3b82f6;
    --good:           #22c55e;
    --warn:           #f59e0b;
    --bad:            #ef4444;

    --radius:         8px;
    --radius-lg:      12px;

    --shadow:         0 1px 0 rgba(255,255,255,0.04), 0 4px 12px rgba(0,0,0,0.3);

    --font-sans:      -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
    --font-mono:      "SF Mono", "Consolas", "Menlo", monospace;
}

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

html, body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

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

input, button, select, textarea { font-family: inherit; font-size: inherit; }

/* ---- Layout primitives ---------------------------------------------------- */

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.center-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

/* ---- Typography ----------------------------------------------------------- */

h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); }
.muted { color: var(--ink-muted); }
.dim   { color: var(--ink-dim); }
.mono  { font-family: var(--font-mono); }

/* ---- Forms --------------------------------------------------------------- */

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.field input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--ink);
    outline: none;
    transition: border-color 0.12s;
}
.field input:focus { border-color: var(--accent); }

/* ---- Buttons ------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-elev);
    border: 1px solid var(--border-strong);
    color: var(--ink);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.12s;
}
.btn:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* ---- Alerts -------------------------------------------------------------- */

.alert {
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 13px;
    margin-bottom: 16px;
}
.alert.err  { border-color: var(--bad);  background: rgba(239,68,68,0.08);  color: #fca5a5; }
.alert.warn { border-color: var(--warn); background: rgba(245,158,11,0.08); color: #fbbf24; }
.alert.info { border-color: var(--info); background: rgba(59,130,246,0.08); color: #93c5fd; }
.alert.ok   { border-color: var(--good); background: rgba(34,197,94,0.08);  color: #86efac; }

/* ---- Pills / tags -------------------------------------------------------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pill.role-admin    { color: var(--accent);  border-color: var(--accent); }
.pill.role-approver { color: var(--info);    border-color: var(--info); }
.pill.role-employee { color: var(--ink-muted); }

/* ---- Header bar ---------------------------------------------------------- */

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .brand {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.005em;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
}
.topbar .brand:hover { text-decoration: none; }
.topbar .brand img {
    height: 36px;
    width: auto;
    display: block;
    /* The logo is dark text on light background — the portal is dark themed,
       so we render it on a soft white pad to keep it legible. */
    background: #fff;
    padding: 4px 8px;
    border-radius: 4px;
}
.topbar .brand .accent { color: var(--accent); }
.topbar nav {
    display: flex;
    gap: 4px;
    margin-left: 16px;
}
.topbar nav a {
    padding: 6px 12px;
    color: var(--ink-muted);
    border-radius: 6px;
}
.topbar nav a:hover { background: var(--bg-card); color: var(--ink); text-decoration: none; }
.topbar nav a.active { background: var(--bg-card); color: var(--ink); }
.topbar .spacer { flex: 1; }
.topbar .user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 13px;
}
.topbar .user-pill .name { color: var(--ink); font-weight: 500; }
.topbar .user-pill .emp  { color: var(--ink-dim); font-family: var(--font-mono); }
.topbar .logout {
    color: var(--ink-muted);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    background: none;
    border: none;
}
.topbar .logout:hover { color: var(--ink); background: var(--bg-card); }

/* ---- Module tiles -------------------------------------------------------- */

.section-title {
    margin: 28px 0 14px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.section-title h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); font-weight: 600; }
.section-title .count { font-size: 12px; color: var(--ink-dim); font-family: var(--font-mono); }

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.tile {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    color: var(--ink);
    text-decoration: none;
    transition: all 0.14s;
    position: relative;
}
.tile:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.tile h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
    text-transform: none;
    letter-spacing: 0;
}
.tile p { color: var(--ink-muted); font-size: 13px; }
.tile .category {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 10px;
    color: var(--ink-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.tile.locked {
    opacity: 0.55;
    cursor: not-allowed;
}
.tile.locked:hover {
    transform: none;
    border-color: var(--border);
    background: var(--bg-card);
    box-shadow: none;
}
.tile.locked::after {
    content: 'NO ACCESS';
    position: absolute;
    bottom: 14px;
    right: 14px;
    font-size: 10px;
    color: var(--bad);
    border: 1px solid var(--bad);
    padding: 2px 8px;
    border-radius: 99px;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.tile.public {
    background: var(--bg-elev);
    border-style: dashed;
}
.tile.public::before {
    content: 'PUBLIC SIGNAGE';
    display: block;
    font-size: 10px;
    color: var(--ink-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    font-weight: 600;
}

/* ---- Tables -------------------------------------------------------------- */

table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
table.data th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
table.data td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--bg-card-hover); }
