@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css");

:root {
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #dbe3ef;
    --border-strong: #b8c5db;
    --brand: #1f4ed8;
    --brand-strong: #1d40b0;
    --danger: #b42318;
    --danger-bg: #fee4e2;
    --ok: #067647;
    --shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a { color: inherit; }

.navbar, .nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.nav-user {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.nav-username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.logo {
    font-weight: 700;
    font-size: 15px;
    margin-right: 8px;
    color: var(--brand);
    flex-shrink: 0;
}
.logo a { display: flex; align-items: center; text-decoration: none; color: inherit; }
.nav-logo-img { max-height: 36px; max-width: 180px; object-fit: contain; }
.logo-fallback { font-weight: 700; font-size: 15px; color: var(--brand); }
.nav-store-num { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.nav-gear-icon { display: block; vertical-align: middle; }

.navbar a, .nav a, .nav button, .navbar button {
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    cursor: pointer;
}

.navbar a:hover, .nav a:hover, .nav button:hover, .navbar button:hover {
    background: #eef3ff;
    border-color: #c9d7ff;
}

/* Boneyard nav — dark pill; same footprint as other navbar links */
.nav a.nav-boneyard {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 400;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    white-space: nowrap;
    background: #111111;
    border: 1px solid #333333;
    position: relative;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.nav a.nav-boneyard .nav-boneyard-icon {
    color: #ff4444;
    font-size: 0.92em;
    line-height: 1;
    flex-shrink: 0;
}
.nav a.nav-boneyard:hover {
    background: #1a1a1a;
    border-color: #ff4444;
    color: #ffffff;
    transform: translateY(-1px);
}
.nav a.nav-boneyard.nav-boneyard--has-items {
    border-color: #ff4444;
    box-shadow: 0 0 6px rgba(255, 68, 68, 0.3);
}
.nav a.nav-boneyard.nav-boneyard--has-items:hover {
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.35);
}
.nav a.nav-boneyard.nav-boneyard--has-items::after {
    content: "";
    position: absolute;
    top: 5px;
    right: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff4444;
    box-shadow: 0 0 0 1px #111111;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px;
}

h1, h2, h3 {
    margin: 0 0 12px;
    font-weight: 700;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.dash-card {
    padding: 16px;
    min-height: 96px;
}

.dash-card .label {
    color: var(--muted);
    font-size: 12px;
}

.dash-card .value {
    margin-top: 8px;
    font-size: 26px;
    font-weight: 700;
    color: var(--brand);
}

/* Default tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    overflow: hidden;
}

th, td {
    border-bottom: 1px solid var(--border);
    padding: 9px 10px;
    text-align: left;
    font-size: 14px;
}

th {
    background: var(--surface-muted);
    color: var(--muted);
    font-weight: 600;
}

tr:hover td {
    background: #f8fbff;
}

/* Ledger-style tables: vertical + horizontal rules, zebra, strong hover */
table.data-rows {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 8px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

table.data-rows th,
table.data-rows td {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    vertical-align: middle;
}

table.data-rows th:last-child,
table.data-rows td:last-child {
    border-right: none;
}

table.data-rows thead th {
    background: #e8edf5;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    border-bottom: 2px solid var(--border-strong);
}

table.data-rows tbody tr {
    cursor: pointer;
    transition: background-color 0.14s ease, box-shadow 0.14s ease;
}

table.data-rows tbody tr:nth-child(even) td {
    background: #f7f9fc;
}

table.data-rows tbody tr:hover td {
    background: #d4e4fc !important;
    box-shadow: inset 4px 0 0 var(--brand);
}

input, select, textarea, button {
    font-family: inherit;
}

input, select, textarea {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
}

button {
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
}

button:hover { background: #eef3ff; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.btn-primary:hover { background: var(--brand-strong); }

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: #fecdca;
}

.muted { color: var(--muted); }

a.email-link {
    color: blue;
    text-decoration: underline;
    cursor: pointer;
}
a.email-link:hover {
    color: darkblue;
}

/* ===== Mobile / Phone friendly (all pages) ===== */
html {
    -webkit-text-size-adjust: 100%;
}
body {
    overflow-x: hidden;
}
.container {
    padding-left: 12px;
    padding-right: 12px;
}
/* Table horizontal scroll on narrow screens */
.table-wrap,
.inv-table-wrap,
.audit-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 12px;
}
table.data-rows,
table {
    min-width: 420px;
}
@media (max-width: 640px) {
    .nav { padding: 8px 10px; gap: 6px; }
    .nav-links { gap: 6px; }
    .nav a, .nav button { padding: 6px 8px; font-size: 12px; }
    .nav-logo-img { max-height: 32px; max-width: 140px; }
    .logo-fallback { font-size: 14px; }
    .container { padding: 10px 10px 20px; }
    .container h1, .container h2 { font-size: 1.25rem; }
    table.data-rows th, table.data-rows td,
    th, td { padding: 7px 8px; font-size: 13px; }
    .dashboard-grid { grid-template-columns: 1fr; gap: 10px; }
    .dash-card { min-height: 80px; padding: 12px; }
    .dash-card .value { font-size: 22px; }
    .card { padding: 12px; }
}
@media (max-width: 480px) {
    .nav { flex-direction: column; align-items: stretch; }
    .nav-user { margin-left: 0; justify-content: flex-start; }
    .nav-username { max-width: 140px; }
    .container { padding: 8px 8px 16px; }
    table.data-rows th, table.data-rows td,
    th, td { padding: 6px 6px; font-size: 12px; }
}
/* Toolbar/row wrappers */
.toolbar, .row, .form-row, .actions {
    flex-wrap: wrap;
}
.toolbar input, .toolbar select {
    min-width: 120px;
    max-width: 100%;
}
/* Cards/modals full width on mobile */
.card-body, .work-card, .pwd-dialog {
    width: min(92vw, 560px) !important;
    max-width: 92vw;
}
/* Form inputs full width on small screens */
@media (max-width: 480px) {
    .form-row input, .form-row select { min-width: 0; width: 100%; }
    .pw-field input { min-width: 0; width: 100%; }
    .panel { padding: 12px; }
}

/* Global unsaved-changes modal (assets/js/unsaved_changes.js) */
.ww-unsaved-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.45);
    box-sizing: border-box;
}
.ww-unsaved-modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
}
.ww-unsaved-modal-box h3 {
    margin: 0 0 10px;
    font-size: 1.15rem;
}
.ww-unsaved-msg {
    margin: 0 0 18px;
    line-height: 1.45;
    font-size: 15px;
    color: var(--text);
}
.ww-unsaved-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}
.ww-unsaved-actions button {
    min-height: 44px;
    padding: 10px 16px;
}
button.ww-unsaved-dirty,
.btn-primary.ww-unsaved-dirty {
    box-shadow: 0 0 0 2px rgba(31, 78, 216, 0.5);
}
