/* ==========================================================================
   Marke Tailor — design tokens (MarkeTech brand identity)
   Self-hosted fonts (Tajawal, SIL OFL) — see assets/fonts/OFL.txt
   ========================================================================== */

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/tajawal-400-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/tajawal-400-arabic.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/tajawal-500-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/tajawal-500-arabic.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/tajawal-700-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/tajawal-700-arabic.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC;
}

:root {
    /* Brand — navy chrome */
    --brand: #0e2038;
    --brand-dark: #0a1626;
    --brand-tint: #16335c;

    /* Accents — bright azure (--accent-blue) is for decorative/background use
       (focus rings, active-nav tint, chrome) only; --accent-blue-text is the
       AA-contrast-verified (>=4.5:1 on white/--surface) shade for link/body text. */
    --accent-gold: #e0a838;
    --accent-gold-dark: #c8902c;
    --accent-blue: #2f9fe0;
    --accent-blue-text: #166b9e;
    --accent-blue-dark: #11567f;

    /* Neutrals — light working surface */
    --ink: #0e2038;
    --muted: #5b6b7d;
    --surface: #f5f7fa;
    --surface-raised: #ffffff;
    --line: #dde3ea;

    /* Semantic — all pairs verified >=4.5:1 (WCAG AA, normal text) */
    --success: #166534;
    --success-bg: #dcfce7;
    --warning: #92400e;
    --warning-bg: #fef3c7;
    --danger: #991b1b;
    --danger-bg: #fee2e2;

    /* Flat tailoring status -> pill colors (each pair verified >=4.5:1) */
    --status-not-ready: #374151;
    --status-not-ready-bg: #eef0f2;
    --status-pending: #92400e;
    --status-pending-bg: #fef3c7;
    --status-laundry: #1d4ed8;
    --status-laundry-bg: #dbeafe;
    --status-ready: #166534;
    --status-ready-bg: #dcfce7;
    --status-delivered: #0e2038;
    --status-delivered-bg: #e2e8f0;
    --status-wastage: #991b1b;
    --status-wastage-bg: #fee2e2;

    /* Type */
    --font-body: "Tajawal", "Segoe UI", Tahoma, sans-serif;
    --font-head: "Tajawal", "Segoe UI", Tahoma, sans-serif;
    --text-sm: 0.8125rem;
    --text-base: 1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.6rem;
    --text-2xl: 2rem;
    --leading: 1.55;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;

    --radius: 0.5rem;
    --shadow: 0 1px 2px rgba(14, 32, 56, 0.06), 0 1px 8px rgba(14, 32, 56, 0.06);
    --on-brand: #ffffff;
}

/* ==========================================================================
   Base
   ========================================================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading);
}

h1, h2, h3 {
    font-family: var(--font-head);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 var(--space-3);
    color: var(--ink);
}

h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-base); font-weight: 500; }

p { margin: 0 0 var(--space-3); }

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

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

:focus-visible {
    outline: 2px solid var(--accent-blue-dark);
    outline-offset: 2px;
}

label {
    display: block;
    font-size: var(--text-sm);
    color: var(--muted);
    margin-bottom: var(--space-1);
    font-weight: 500;
}

.app-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: var(--space-5);
}

/* ==========================================================================
   Top navigation — navy chrome, logo mark, active-page indicator
   ========================================================================== */

.top-nav {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: 3.75rem;
    padding: var(--space-3) var(--space-4);
    background: var(--brand);
    color: var(--on-brand);
}

.top-nav a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
}

.brand {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--on-brand);
}

.brand-mark {
    flex: 0 0 auto;
    display: inline-flex;
    line-height: 0;
}

.nav-links {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    justify-content: center;
}

.nav-links a,
.logout {
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
}

.nav-links a:hover,
.logout:hover {
    background: var(--brand-dark);
    color: var(--on-brand);
    text-decoration: none;
}

.nav-links a.is-active {
    background: var(--brand-tint);
    color: var(--on-brand);
    font-weight: 500;
    box-shadow: inset 0 -2px 0 var(--accent-blue);
}

[dir="rtl"] .top-nav {
    direction: rtl;
}

@media (max-width: 760px) {
    .top-nav {
        align-items: stretch;
        flex-direction: column;
    }

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

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
}

.card > h1:first-child,
.card > h2:first-child {
    margin-top: 0;
}

.container {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-5);
}

/* ==========================================================================
   Tables
   ========================================================================== */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

table.data-table,
.card table,
.container table {
    background: var(--surface-raised);
}

th, td {
    padding: var(--space-2) var(--space-3);
    text-align: start;
    border-bottom: 1px solid var(--line);
}

th {
    color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    background: var(--surface);
}

tbody tr:hover {
    background: var(--surface);
}

tfoot td,
tfoot th {
    font-weight: 700;
    border-top: 2px solid var(--line);
    border-bottom: none;
    background: var(--surface);
}

.money-omr {
    font-variant-numeric: tabular-nums;
    text-align: end;
    white-space: nowrap;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

button,
.btn {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-4);
    cursor: pointer;
    background: var(--brand);
    color: var(--on-brand);
}

button:hover,
.btn:hover {
    background: var(--brand-dark);
}

.btn-primary,
button[type="submit"] {
    background: var(--accent-gold);
    color: var(--brand-dark);
}

.btn-primary:hover,
button[type="submit"]:hover {
    background: var(--accent-gold-dark);
    color: var(--brand-dark);
}

.btn-secondary {
    background: transparent;
    color: var(--brand);
    border: 1px solid var(--line);
}

.btn-secondary:hover {
    background: var(--surface);
}

.remove-row {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: var(--space-1) var(--space-3);
}

.remove-row:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ==========================================================================
   Form fields
   ========================================================================== */

input,
select,
textarea {
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--ink);
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    min-height: 2.5rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-blue-dark);
    box-shadow: 0 0 0 3px rgba(47, 159, 224, 0.18);
}

form label {
    margin-top: var(--space-3);
}

.stack {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.customer-form label,
.stack label {
    margin-top: 0;
}

/* ==========================================================================
   Alerts / banners
   ========================================================================== */

.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
}

.alert-error,
.form-error,
.errors {
    background: var(--danger-bg);
    color: var(--danger);
}

.warning-banner {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
}

.empty-state {
    color: var(--muted);
    padding: var(--space-5);
    text-align: center;
}

/* ==========================================================================
   Status pills (US3 — one mapping, used everywhere a status renders)
   ========================================================================== */

.status-badge,
.status-pill {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    border-radius: 999px;
    font-size: var(--text-sm);
    font-weight: 500;
    background: var(--status-not-ready-bg);
    color: var(--status-not-ready);
}

.status-pill--not-ready { background: var(--status-not-ready-bg); color: var(--status-not-ready); }
.status-pill--pending   { background: var(--status-pending-bg); color: var(--status-pending); }
.status-pill--laundry   { background: var(--status-laundry-bg); color: var(--status-laundry); }
.status-pill--ready     { background: var(--status-ready-bg); color: var(--status-ready); }
.status-pill--delivered { background: var(--status-delivered-bg); color: var(--status-delivered); }
.status-pill--wastage   { background: var(--status-wastage-bg); color: var(--status-wastage); }
.status-pill--draft     { background: var(--status-not-ready-bg); color: var(--status-not-ready); }
.status-pill--posted    { background: var(--status-ready-bg); color: var(--status-ready); }
.status-pill--dispatched{ background: var(--status-laundry-bg); color: var(--status-laundry); }
.status-pill--received  { background: var(--status-delivered-bg); color: var(--status-delivered); }
.status-pill--reversed  { background: var(--status-wastage-bg); color: var(--status-wastage); }

/* ==========================================================================
   Dashboard cards
   ========================================================================== */

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.dashboard-card {
    display: block;
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-5);
    text-align: center;
}

.dashboard-card:hover {
    border-color: var(--accent-blue-dark);
    text-decoration: none;
}

.dashboard-card h2 {
    font-size: var(--text-2xl);
    color: var(--brand);
    margin: 0 0 var(--space-1);
}

.dashboard-card p {
    margin: 0;
    color: var(--muted);
    font-size: var(--text-sm);
}

/* ==========================================================================
   Login page (standalone head)
   ========================================================================== */

.login-page {
    background: var(--brand);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-shell {
    background: var(--surface-raised);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-6);
    width: 100%;
    max-width: 360px;
}

.login-shell .brand {
    color: var(--brand);
    font-size: var(--text-lg);
    margin-bottom: var(--space-1);
    justify-content: flex-start;
}

.login-shell h2 {
    color: var(--muted);
    font-weight: 500;
    font-size: var(--text-base);
    margin-bottom: var(--space-4);
}

.login-shell form label {
    margin-top: var(--space-3);
}

.login-shell button {
    width: 100%;
    margin-top: var(--space-4);
}

/* ==========================================================================
   Status badge inline on detail pages
   ========================================================================== */

.status-badge {
    margin-inline-start: var(--space-1);
}

/* ==========================================================================
   RTL
   ========================================================================== */

[dir="rtl"] table th,
[dir="rtl"] table td {
    text-align: start;
}

@media (max-width: 760px) {
    .app-shell {
        padding: var(--space-4);
    }

    .dashboard-cards {
        grid-template-columns: 1fr 1fr;
    }
}
