/* Onyx Peptide Admin — design system */

:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --border: #e3e6ea;
    --text: #1a1d23;
    --text-muted: #6b7280;
    --text-faint: #9aa1ab;
    --primary: #2a5db0;
    --primary-hover: #1f4a91;
    --primary-soft: #eaf1fc;
    --danger: #b3261e;
    --danger-hover: #8f1e18;
    --danger-soft: #fbe9e8;
    --success: #1e7d34;
    --success-soft: #e6f4ea;
    --amber: #8a5a00;
    --amber-soft: #fff4e0;
    --sidebar-bg: #14161a;
    --sidebar-text: #b8bcc4;
    --sidebar-active: #2a5db0;
    --radius: 8px;
    --radius-sm: 5px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
    font-size: 15px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

.shell { display: flex; min-height: 100vh; }

/* Sidebar */
nav.sidebar {
    width: 232px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}
nav.sidebar .brand {
    color: #fff;
    font-weight: 650;
    font-size: 15px;
    letter-spacing: 0.01em;
    padding: 0 20px 18px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
nav.sidebar .nav-section {
    padding: 10px 20px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6f7580;
}
nav.sidebar a.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: background 0.12s ease;
}
nav.sidebar a.nav-link:hover { background: rgba(255,255,255,0.05); text-decoration: none; color: #fff; }
nav.sidebar a.nav-link.active { background: rgba(42,93,176,0.18); color: #fff; border-left-color: var(--sidebar-active); font-weight: 600; }
nav.sidebar .nav-icon { width: 16px; text-align: center; opacity: 0.85; font-size: 13px; }
nav.sidebar .spacer { flex: 1; }
nav.sidebar .nav-footer { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 10px; margin-top: 10px; }

/* Main column */
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 56px;
    flex-shrink: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
}
.topbar h1 { font-size: 16px; font-weight: 650; margin: 0; }
.topbar .topbar-meta { font-size: 12.5px; color: var(--text-muted); }
main.content { flex: 1; padding: 24px 28px 60px; max-width: 1180px; width: 100%; }

/* Flash */
.flash { padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 13.5px; border: 1px solid transparent; }
.flash.success { background: var(--success-soft); color: var(--success); border-color: #b7e1c1; }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: #f0b8ba; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-header h2 { font-size: 19px; margin: 0; font-weight: 650; }
.page-header .sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.card h3.card-title { margin: 0 0 14px; font-size: 14.5px; font-weight: 650; }
.card p.hint { color: var(--text-muted); font-size: 12.5px; margin: -6px 0 14px; }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat-tile .label { color: var(--text-muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-tile .value { font-size: 30px; font-weight: 700; margin-top: 6px; }
.stat-tile .value a { color: inherit; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
thead th { background: #fafbfc; font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }
tbody tr[data-href] { cursor: pointer; }
tbody tr[data-href]:hover { background: var(--primary-soft); }
tbody tr[data-href] a.row-action { color: var(--text-muted); font-size: 12.5px; }
tbody tr[data-href] a.row-action:hover { color: var(--primary); }

.table-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.table-toolbar h3 { margin: 0; font-size: 15px; font-weight: 650; }
.section-block { margin-bottom: 32px; }

/* Forms */
label {
    display: block; font-size: 12px; font-weight: 700; margin: 18px 0 6px;
    color: #4a5160; text-transform: uppercase; letter-spacing: 0.04em;
}
label:first-child { margin-top: 0; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
select, textarea {
    width: 100%; padding: 10px 12px; border: 1.5px solid transparent; border-radius: 8px;
    font-size: 14px; font-family: inherit; color: var(--text);
    background: #f0f2f5;
    transition: background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
    line-height: 1.35;
}
input::placeholder, textarea::placeholder { color: #a4aab3; }

input:hover, select:hover, textarea:hover { background: #e9ecf0; }

input:focus, select:focus, textarea:focus {
    outline: none; background: #fff; border-color: var(--primary);
    box-shadow: 0 0 0 3.5px rgba(42,93,176,0.16);
}

input[disabled], select[disabled], textarea[disabled] { opacity: 0.6; cursor: not-allowed; }

select {
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

textarea { resize: vertical; min-height: 44px; }
textarea.raw-json { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > div, .row > select, .row > input { flex: 1; min-width: 140px; }

.checkbox-row { display: flex; align-items: center; gap: 9px; }
.checkbox-row label {
    margin: 0; font-weight: 550; text-transform: none; letter-spacing: normal;
    font-size: 13.5px; color: var(--text); cursor: pointer;
}
.checkbox-row input[type=checkbox] {
    width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--primary); cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; cursor: pointer; line-height: 1.3;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid #d3d7dd; }
.btn.secondary:hover { background: #f5f6f8; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: var(--danger-hover); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.icon-only { padding: 5px 9px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 650; letter-spacing: 0.01em; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.gray { background: #eceef1; color: #4a4f57; }

.muted { color: var(--text-muted); font-size: 12px; }
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: #eee; border: 1px solid var(--border); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 16px; padding: 14px 16px; }
legend { font-weight: 650; font-size: 13px; padding: 0 6px; }
.actions { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }

/* Tabs */
.tabs-nav { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tabs-nav button {
    background: none; border: none; padding: 10px 16px; font-size: 13.5px; font-weight: 600;
    color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tabs-nav button:hover { color: var(--text); }
.tabs-nav button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Chips (tag input) */
.chip-field { border: 1.5px solid #e3e6ea; border-radius: 8px; padding: 10px; background: #fff; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip-list:empty { margin-bottom: 0; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); color: var(--primary);
    padding: 4px 8px 4px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
}
.chip button { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px; opacity: 0.65; }
.chip button:hover { opacity: 1; }
.chip-input-row { display: flex; gap: 6px; }
.chip-input-row input { background: #f0f2f5; padding: 7px 10px; }

/* Repeatable rows (structured list editor) */
.rows-field { display: flex; flex-direction: column; gap: 10px; }
.rows-item { border: 1.5px solid #e3e6ea; border-radius: 8px; padding: 14px; background: #fafbfc; position: relative; }
.rows-item .rows-item-fields { display: flex; gap: 10px; flex-wrap: wrap; }
.rows-item .rows-item-fields > div { flex: 1; min-width: 160px; }
.rows-item .rows-item-fields label { margin-top: 0; font-size: 11px; }
.rows-item .rows-item-fields input, .rows-item .rows-item-fields textarea { background: #fff; }
.rows-item .rows-remove { position: absolute; top: 10px; right: 10px; }
.rows-add { margin-top: 4px; align-self: flex-start; }

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    nav.sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 10px; }
    nav.sidebar .brand, nav.sidebar .nav-section, nav.sidebar .nav-footer { display: none; }
    nav.sidebar a.nav-link { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
    nav.sidebar a.nav-link.active { border-bottom-color: var(--sidebar-active); }
}
