:root {
    --page-bg: #f5f7fb;
    --surface: #ffffff;
    --text: #26334b;
    --subtle: #718096;
    --primary: #3566d6;
    --primary-hover: #2854be;
    --border: #e5eaf2;
}

* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--page-bg);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    line-height: 1.55;
}
a { text-decoration: none; }
a:hover { text-decoration: none; }
.page-width { width: min(1120px, calc(100% - 40px)); margin-left: auto; margin-right: auto; }
.site-header { background: #fff; border-bottom: 1px solid var(--border); }
.site-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 74px; }
.site-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-weight: 700; font-size: 18px; }
.site-brand:hover { color: var(--text); }
.brand-icon { background: #e8efff; color: var(--primary); border-radius: 10px; min-width: 40px; height: 40px; display: inline-grid; place-items: center; font-weight: 800; font-size: 15px; }
.nav-link-custom { color: #52627d; padding: 7px 0; font-size: 14px; font-weight: 600; }
.nav-link-custom:hover { color: var(--primary); }
.main-content { flex: 1; padding-top: 42px; padding-bottom: 68px; }
.page-heading { margin-bottom: 28px; }
h1,h2,h3,p { margin-top: 0; }
h1 { font-size: clamp(28px, 3vw, 36px); line-height: 1.25; font-weight: 740; letter-spacing: -.5px; margin-bottom: 8px; }
h2 { font-size: 19px; font-weight: 700; margin-bottom: 5px; }
.page-heading p, .panel-title p, .list-top p { color: var(--subtle); font-size: 14px; margin: 0; }
.dashboard-grid { display: grid; grid-template-columns: minmax(270px, 340px) minmax(0, 1fr); align-items: start; gap: 22px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; box-shadow: 0 2px 11px rgba(26,47,83,.035); }
.form-panel { padding: 27px; }
.panel-title { margin-bottom: 25px; }
.form-field { margin-bottom: 20px; }
.form-field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.required { color: #df5858; }
.text-input { width: 100%; height: 46px; border: 1px solid #d7dfeb; border-radius: 8px; background: #fff; padding: 0 13px; color: var(--text); outline: none; transition: border-color .18s, box-shadow .18s; }
.text-input::placeholder { color: #9aa8ba; }
.text-input:focus { border-color: #7c9cec; box-shadow: 0 0 0 3px rgba(53,102,214,.1); }
.btn-main, .btn-secondary, .btn-danger-outline { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; border-radius: 8px; padding: 10px 17px; border: 1px solid transparent; font-size: 14px; font-weight: 650; cursor: pointer; transition: background-color .18s, transform .18s, border-color .18s; }
.btn-main { color: #fff; background: var(--primary); }
.btn-main:hover { color: #fff; background: var(--primary-hover); transform: translateY(-1px); }
.btn-full { width: 100%; }
.btn-secondary { color: #53637d; background: #f4f6fa; border-color: var(--border); }
.btn-secondary:hover { color: var(--text); background: #e9edf4; }
.btn-danger-outline { color: #bb4040; background: #fff; border-color: #efcccc; }
.btn-danger-outline:hover { background: #fff1f1; border-color: #e7a4a4; }
.list-panel { overflow: hidden; }
.list-top { padding: 25px 25px 20px; display: flex; justify-content: space-between; align-items: center; }
.table-wrap { overflow-x: auto; }
.data-table { border-collapse: collapse; width: 100%; min-width: 450px; }
.data-table th { background: #f8faff; font-size: 12px; text-transform: uppercase; letter-spacing: .35px; color: #73839c; padding: 13px 24px; text-align: left; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-weight: 700; }
.data-table td { border-bottom: 1px solid #edf0f6; padding: 16px 24px; font-size: 14px; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafcff; }
.id-cell { color: #7b89a0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.name-cell { font-weight: 600; }
.col-action, .action-cell { text-align: right !important; white-space: nowrap; }
.link-action { color: var(--primary); font-weight: 650; margin-left: 12px; }
.link-action:hover { color: #214cb0; text-decoration: underline; }
.muted-action { color: #64748b; }
.empty-state { padding: 35px 25px 42px; font-size: 14px; color: var(--subtle); border-top: 1px solid var(--border); }
.notice { padding: 13px 17px; border-radius: 9px; margin-bottom: 19px; font-size: 14px; border: 1px solid; }
.notice-success { color: #22684d; background: #ecf8f1; border-color: #bee9d1; }
.notice-error { color: #a13c3c; background: #fff2f1; border-color: #f4c8c5; }
.subpage-header { margin: 0 0 25px; }
.back-link { display: inline-block; color: var(--primary); font-weight: 600; font-size: 14px; margin-bottom: 16px; }
.back-link:hover { text-decoration: underline; }
.details-panel, .edit-panel { max-width: 600px; padding: 30px; }
.detail-row { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 18px; border-bottom: 1px solid var(--border); padding: 16px 0; }
.detail-row:first-child { padding-top: 0; }
.detail-row span { font-size: 14px; color: var(--subtle); }
.detail-row strong { font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.button-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.button-row form { margin: 0; }
.readonly-box { padding: 11px 13px; background: #f5f7fb; border: 1px solid var(--border); border-radius: 8px; color: #68788f; }
.validation-text { display: block; font-size: 13px; color: #ba3b3b; margin-top: 5px; }
.site-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 18px 0; color: #8994a7; font-size: 13px; }
@media (max-width: 820px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-panel { padding: 23px; }
    .main-content { padding-top: 32px; }
}
@media (max-width: 520px) {
    .page-width { width: calc(100% - 28px); }
    .site-brand { font-size: 15px; }
    .site-nav { min-height: 64px; }
    .nav-link-custom { font-size: 12px; }
    .list-top { padding: 22px 20px; }
    .details-panel, .edit-panel { padding: 22px; }
    .detail-row { grid-template-columns: 1fr; gap: 4px; }
    .button-row > *, .button-row form, .button-row form button { width: 100%; }
}
@media (max-width: 520px) {
    .data-table { min-width: 0; }
    .data-table th, .data-table td { padding: 12px 10px; }
    .muted-action { display: none; }
    .link-action { margin-left: 4px; }
}
