/* AIMS Pay Support — plain CSS, no build step. */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #dde1e6;
    --text: #1f2933;
    --muted: #66717d;
    --accent: #1f5fbf;
    --accent-hover: #184c99;
    --accent-soft: #e8f0fb;
    --success-bg: #e7f6ec;
    --success-text: #1d6b36;
    --error-bg: #fdecec;
    --error-text: #a12626;
    --info-bg: #eef3fb;
    --info-text: #284a7a;
    --code-bg: #f0f2f5;
    --radius: 6px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 var(--font);
}

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

h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 16px; margin: 24px 0 10px; font-weight: 600; }
.card h2:first-child { margin-top: 0; }

code {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--code-bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 400;
    color: var(--muted);
}

pre {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--code-bg);
    padding: 10px 12px;
    border-radius: var(--radius);
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 480px;
    overflow: auto;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
.null { color: var(--muted); font-style: italic; font-family: var(--mono); font-size: 12px; }
.type { color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 400; margin-left: 6px; }
.error { color: var(--error-text); display: block; margin-top: 4px; }

/* Layout */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 20px;
    height: 52px;
    background: #17212b;
    color: #fff;
}
.brand { color: #fff; font-weight: 600; font-size: 16px; }
.brand span { color: #9fb3c8; font-weight: 400; }
.brand:hover { text-decoration: none; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-user .muted { color: #c7d2dd; }
.topbar-user form { margin: 0; }

.shell { display: flex; min-height: calc(100vh - 52px); }

.sidebar {
    width: 220px;
    flex: 0 0 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 12px 0 24px;
}
.sidebar a {
    display: block;
    padding: 6px 20px;
    color: var(--text);
}
.sidebar a:hover { background: var(--bg); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; border-left: 3px solid var(--accent); padding-left: 17px; }
.nav-group {
    padding: 14px 20px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.content { flex: 1; min-width: 0; padding: 24px 28px 48px; }

.guest { display: flex; justify-content: center; padding: 64px 16px; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.page-head p { margin: 4px 0 0; }
.crumbs { font-size: 12px; margin: 0 0 2px !important; }

/* Components */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 16px;
}

.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-info { background: var(--info-bg); color: var(--info-text); }

.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
    font-family: var(--font);
    font-style: normal;
}
.badge-edit { background: var(--accent-soft); color: var(--accent); }
.badge-view { background: var(--code-bg); color: var(--muted); }

.btn {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    cursor: pointer;
    line-height: 1.4;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-small { padding: 4px 10px; font-size: 12px; }
.topbar .btn-small { background: transparent; color: #fff; border-color: #44556a; }
.topbar .btn-small:hover { background: #24313f; }
.btn-block { display: block; width: 100%; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.page-head .actions { margin-top: 0; }

/* Forms */

label { display: block; font-weight: 600; margin: 0 0 4px; }

input[type=text], input[type=search], input[type=password], input[type=datetime-local], select, textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    background: #fff;
    color: var(--text);
}
textarea { font-family: var(--mono); font-size: 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.input-row { display: flex; gap: 8px; }
.input-row select { flex: 0 0 45%; min-width: 0; }

.checkbox { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin-top: 6px; }
.checkbox input { margin: 0; }

.login-card { width: 100%; max-width: 380px; padding: 24px; }
.login-card label { margin-top: 14px; }
.login-card .btn { margin-top: 20px; }

.quick-search .input-row input { flex: 1; }
.quick-search .btn { flex: 0 0 auto; }

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px 16px;
}
.field small { display: block; margin-top: 4px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    padding: 3px 12px;
    font-family: var(--mono);
    font-size: 12px;
}

.edit-form .form-row { padding: 10px 0; border-bottom: 1px solid var(--bg); }
.edit-form .form-row:last-of-type { border-bottom: 0; }
.edit-form .has-error input, .edit-form .has-error textarea, .edit-form .has-error select { border-color: var(--error-text); }
.readonly-value { padding: 6px 0; word-break: break-word; }
.readonly-value .badge { margin-left: 8px; }

/* Home tiles */

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    color: var(--text);
}
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile code { align-self: flex-start; }
.tile .badge { align-self: flex-start; margin-top: 4px; }

/* Data table */

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    white-space: nowrap;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
}
table.data th { background: #fafbfc; font-size: 12px; font-family: var(--mono); font-weight: 600; }
table.data th a { color: var(--text); }
table.data tbody tr:hover { background: #fafcff; }
table.data tbody tr:last-child td { border-bottom: 0; }

/* Record view */

dl.record { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; margin: 0; }
dl.record dt, dl.record dd { padding: 8px 0; border-bottom: 1px solid var(--bg); margin: 0; }
dl.record dt { font-family: var(--mono); font-size: 12px; font-weight: 600; padding-right: 16px; word-break: break-all; }
dl.record dt .muted { display: block; font-family: var(--font); font-weight: 400; }
dl.record dd { word-break: break-word; min-width: 0; }

.related ul { margin: 0; padding-left: 18px; columns: 2; }
.related li { margin-bottom: 4px; break-inside: avoid; }

/* Pagination (Laravel's bootstrap-4 markup) */

.pagination { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; padding: 0; margin: 16px 0 0; }
.page-link {
    display: block;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
}
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-item.disabled .page-link { color: var(--muted); background: var(--bg); }

/* Small screens */

@media (max-width: 760px) {
    .shell { flex-direction: column; }
    .sidebar {
        width: auto;
        flex: none;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        display: flex;
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 2px 4px;
    }
    .sidebar a { padding: 4px 8px; border-radius: var(--radius); }
    .sidebar a.active { border-left: 0; padding-left: 8px; }
    .nav-group { width: 100%; padding: 8px 8px 2px; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .topbar-user .muted { display: none; }
    dl.record { grid-template-columns: 1fr; }
    dl.record dt { border-bottom: 0; padding-bottom: 0; }
    .related ul { columns: 1; }
    .input-row { flex-direction: column; }
    .input-row select { flex: none; }
}
