/* VmwarePanel admin and customer panels. Same brand tokens as the public
   site; logical properties throughout so Persian (RTL) and English (LTR)
   share one stylesheet. */
@font-face {
    font-family: "IRANSans";
    src: url("/site/fonts/iransans.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "IRANSans";
    src: url("/site/fonts/iransans-bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}

:root {
    --graphite: #25282c;
    --graphite-deep: #1b1d20;
    --graphite-line: #33373c;
    --lime: #c2d62f;
    --lime-ink: #1f2400;
    --paper: #f2f4ef;
    --surface: #ffffff;
    --ink: #1a1d20;
    --slate: #59616a;
    --line: #d7dcd1;
    --line-soft: #e8ebe4;
    --on-dark: #eef0ea;
    --on-dark-muted: #a9b0a6;
    --ok: #2f7d32;
    --ok-bg: #e5f2e3;
    --warn: #8a5a00;
    --warn-bg: #fbf0d6;
    --danger: #b3261e;
    --danger-bg: #fbe4e2;
    --muted-bg: #eceee9;
    --font: "IRANSans", Tahoma, "Segoe UI", system-ui, sans-serif;
    --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.8;
}
[dir="ltr"] body { line-height: 1.6; }

a { color: inherit; }
img { display: block; max-width: 100%; }

:focus-visible {
    outline: 3px solid var(--lime);
    outline-offset: 2px;
    border-radius: 4px;
}

.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--slate); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* Shell */
.shell {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: var(--graphite);
    color: var(--on-dark);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    font-weight: 700;
    padding-inline: .5rem;
}
.brand small {
    display: block;
    font-weight: 400;
    font-size: .78rem;
    color: var(--on-dark-muted);
    line-height: 1.3;
}

.nav { display: flex; flex-direction: column; gap: .15rem; margin: 0; padding: 0; list-style: none; }
.nav a {
    display: block;
    padding: .45rem .75rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--on-dark-muted);
}
.nav a:hover { color: var(--on-dark); background: #2e3236; }
.nav a[aria-current="page"] {
    color: var(--on-dark);
    background: #2e3236;
    box-shadow: inset 3px 0 0 var(--lime);
}
[dir="rtl"] .nav a[aria-current="page"] { box-shadow: inset -3px 0 0 var(--lime); }

.sidebar-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    font-size: .88rem;
    color: var(--on-dark-muted);
    padding-inline: .5rem;
}
.sidebar-foot form { margin: 0; }
.link-btn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.link-btn:hover { color: var(--on-dark); }

.main { padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem; min-width: 0; }

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-head h1 { margin: 0; font-size: 1.45rem; line-height: 1.5; }
.page-head p { margin: .2rem 0 0; color: var(--slate); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.5;
    white-space: nowrap;
}
.btn-primary { background: var(--graphite); color: #fff; }
.btn-primary:hover { background: var(--graphite-deep); }
.btn-accent { background: var(--lime); color: var(--lime-ink); }
.btn-accent:hover { background: #d3e64a; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--slate); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #e9b8b4; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: .25rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }

/* Panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 1.25rem;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { margin: 0; font-size: 1.02rem; }
.panel-body { padding: 1.25rem; }
.panel-body > :first-child { margin-top: 0; }
.panel-body > :last-child { margin-bottom: 0; }

/* Stat strip: one row, divided, not a card grid */
.stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 1.25rem;
}
.stat { padding: 1rem 1.25rem; border-inline-start: 1px solid var(--line-soft); }
.stat:first-child { border-inline-start: 0; }
.stat dt { color: var(--slate); font-size: .85rem; }
.stat dd { margin: .15rem 0 0; font-size: 1.6rem; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat a { text-decoration: none; }
.stat dd a:hover { text-decoration: underline; text-decoration-color: var(--lime); text-decoration-thickness: 3px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .7rem 1rem; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
th { font-size: .82rem; color: var(--slate); font-weight: 700; background: #fafbf8; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcf9; }
td .sub { display: block; color: var(--slate); font-size: .85rem; }

/* Definition lists */
.details { display: grid; grid-template-columns: 11rem minmax(0, 1fr); margin: 0; }
.details dt { color: var(--slate); padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.details dd { margin: 0; padding: .55rem 0; border-bottom: 1px solid var(--line-soft); min-width: 0; overflow-wrap: anywhere; }
.details dt:last-of-type, .details dd:last-of-type { border-bottom: 0; }

/* Badges */
.badge {
    display: inline-block;
    padding: .05rem .6rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    background: var(--muted-bg);
    color: var(--slate);
    white-space: nowrap;
}
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-suspended, .badge-cancelled { background: var(--danger-bg); color: var(--danger); }
.badge-legacy { background: #eef1dc; color: #4d5a00; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.form-grid .full { grid-column: 1 / -1; }
.field label, .field .label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .3rem; }
.field .help { display: block; color: var(--slate); font-size: .83rem; margin-top: .3rem; }
.field .error { display: block; color: var(--danger); font-size: .85rem; margin-top: .3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="search"], input[type="tel"], select, textarea {
    width: 100%;
    font: inherit;
    font-size: 16px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .5rem .75rem;
    line-height: 1.6;
}
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--graphite); outline: 2px solid var(--lime); outline-offset: 0; }
[aria-invalid="true"] { border-color: var(--danger); }
.check { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; }
.check input { margin-top: .4rem; accent-color: var(--graphite); }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters input[type="search"] { max-width: 22rem; }
.filters select { width: auto; }

/* Permission matrix */
.perm-group { border-top: 1px solid var(--line-soft); padding-block: .9rem; display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem; }
.perm-group:first-of-type { border-top: 0; padding-top: 0; }
.perm-group h3 { margin: 0; font-size: .95rem; }
.perm-list { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; }
.perm-list .check { font-size: .9rem; }
.perm-list .inherited { color: var(--slate); }

/* Alerts */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; border: 1px solid; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: #bfdcbc; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #efc2be; }
.alert-note { background: #f6f8e4; color: #4d5a00; border-color: #dde5a6; }
.alert ul { margin: 0; padding-inline-start: 1.2rem; }

.empty { padding: 2.5rem 1.25rem; text-align: center; color: var(--slate); }
.empty p { margin: 0 0 1rem; }

.secret { display: inline-flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.secret code { background: var(--muted-bg); padding: .15rem .5rem; border-radius: 6px; }

/* Pagination (Laravel simple-default markup) */
nav[role="navigation"] { margin-top: 1rem; }
nav[role="navigation"] svg { width: 1rem; height: 1rem; }

/* Auth pages */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}
.auth-side {
    background:
        linear-gradient(135deg, transparent 0 55%, #202226 55% 100%),
        var(--graphite);
    color: var(--on-dark);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
[dir="rtl"] .auth-side {
    background:
        linear-gradient(225deg, transparent 0 55%, #202226 55% 100%),
        var(--graphite);
}
.auth-side h2 { font-size: 1.6rem; line-height: 1.5; margin: 0 0 .75rem; max-width: 20ch; }
.auth-side p { color: var(--on-dark-muted); margin: 0; max-width: 34rem; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 26rem; }
.auth-card h1 { font-size: 1.4rem; margin: 0 0 .3rem; }
.auth-card > p { color: var(--slate); margin: 0 0 1.5rem; }
.auth-card .field { margin-bottom: 1rem; }
.auth-foot { margin-top: 1.25rem; color: var(--slate); font-size: .92rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.auth-foot form { margin: 0; }

/* Mobile */
.menu-toggle { display: none; }

@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stat:nth-child(4) { border-inline-start: 0; }
    .stat:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
}

@media (max-width: 1200px) {
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .sidebar { position: static; height: auto; padding: .75rem 1rem; gap: .75rem; }
    .sidebar-top { display: flex; align-items: center; justify-content: space-between; }
    .menu-toggle { display: inline-flex; }
    .sidebar .nav, .sidebar .sidebar-foot { display: none; }
    .sidebar.open .nav, .sidebar.open .sidebar-foot { display: flex; }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-side { padding: 1.5rem 1.25rem; }
    .auth-side .pitch { display: none; }
}

@media (max-width: 640px) {
    .main { padding-top: 1.25rem; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat { border-inline-start: 0; border-top: 1px solid var(--line-soft); }
    .stat:nth-child(-n+2) { border-top: 0; }
    .stat:nth-child(even) { border-inline-start: 1px solid var(--line-soft); }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .details { grid-template-columns: minmax(0, 1fr); }
    .details dt { border-bottom: 0; padding-bottom: 0; }
    .perm-group { grid-template-columns: minmax(0, 1fr); gap: .4rem; }
    th, td { padding: .6rem .7rem; }

    /* Stacked tables: each row becomes a block with labelled cells. */
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: .6rem 0; border-bottom: 1px solid var(--line-soft); }
    .table-stack tbody tr:last-child { border-bottom: 0; }
    .table-stack td { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: .75rem; border: 0; padding: .25rem .9rem; }
    .table-stack td::before { content: attr(data-label); color: var(--slate); font-size: .85rem; }
    .table-stack td > * { justify-self: start; }
    .table-stack td.num { text-align: start; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.error-page { min-height: 100vh; }
.error-page h1 { margin-top: 1rem; }
