/* Kings Capital Admin Panel */
:root {
    --navy: #0b1f3a; --navy-2: #12294b; --green: #00a870; --green-dark: #008f5e; --green-soft: #e6f7f0;
    --gold: #d4a017; --gold-soft: #fbf3dc; --ink: #172033; --ink-2: #4b5567; --muted: #7b8496;
    --line: #e4e8ef; --bg: #f4f7fa; --danger: #d64545; --danger-soft: #fdecec; --warning: #b7791f;
    --warning-soft: #fff5e0; --info: #2b6cb0; --info-soft: #e8f1fb; --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Inter", "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; color: var(--navy); }
h2 { font-size: 1.05rem; color: var(--navy); margin-bottom: .7rem; }
h3 { font-size: .95rem; color: var(--navy); }
p { margin-bottom: .8rem; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.inline { display: inline; }

/* Layout */
.topbar { background: var(--navy); color: #fff; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 1rem; position: sticky; top: 0; z-index: 40; }
.brand { display: flex; align-items: center; gap: .5rem; color: #fff; font-weight: 800; }
.brand span.mark { width: 30px; height: 30px; border-radius: 8px; background: var(--gold); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; }
.brand small { font-weight: 500; opacity: .7; font-size: .75rem; margin-left: .3rem; }
.topbar-right { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.menu-btn { background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }
.shell { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 220px; background: #fff; border-right: 1px solid var(--line); padding: 1rem .7rem; flex-shrink: 0; position: fixed; top: 56px; bottom: 0; left: -240px; transition: left .2s; z-index: 30; overflow-y: auto; }
.sidebar.open { left: 0; }
.sidebar a { display: flex; justify-content: space-between; align-items: center; padding: .55rem .8rem; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: .88rem; }
.sidebar a.active { background: var(--navy); color: #fff; }
.sidebar a:hover:not(.active) { background: var(--bg); text-decoration: none; }
.sidebar .group { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .9rem .8rem .3rem; font-weight: 700; }
.content { flex: 1; padding: 1.2rem 1rem 3rem; min-width: 0; }
@media (min-width: 960px) {
    .sidebar { position: sticky; left: 0; top: 56px; height: calc(100vh - 56px); }
    .menu-btn { display: none; }
    .content { padding: 1.6rem 2rem 3rem; }
}

/* Components */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: 1.1rem; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .7rem; }
.card-head h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin-bottom: 1.2rem; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .stats { grid-template-columns: repeat(5, 1fr); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: block; color: inherit; }
.stat:hover { border-color: var(--green); text-decoration: none; }
.stat .n { font-size: 1.6rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat .l { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.stat.warn .n { color: var(--warning); }
.stat.hot .n { color: var(--danger); }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; } }

.pill { display: inline-flex; padding: .18rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.pill-success { background: var(--green-soft); color: #0d6b48; } .pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-info { background: var(--info-soft); color: var(--info); } .pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: #eef0f4; color: var(--ink-2); }
.count { background: var(--gold); color: var(--navy); font-size: .7rem; font-weight: 800; border-radius: 999px; padding: .1rem .45rem; }

.btn { display: inline-flex; align-items: center; gap: .3rem; padding: .5rem .9rem; border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: .85rem; cursor: pointer; font-family: inherit; line-height: 1.2; text-decoration: none !important; }
.btn-primary { background: var(--green); color: #fff; } .btn-primary:hover { background: var(--green-dark); }
.btn-navy { background: var(--navy); color: #fff; } .btn-gold { background: var(--gold); color: var(--navy); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--navy); } .btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; } .btn-warn { background: var(--warning); color: #fff; }
.btn-sm { padding: .35rem .65rem; font-size: .78rem; } .btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

.form { display: grid; gap: .8rem; }
.form-grid { display: grid; gap: .8rem; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
label { display: block; font-size: .8rem; font-weight: 700; color: var(--navy); margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=url], select, textarea {
    width: 100%; padding: .6rem .7rem; border: 1px solid #cfd6e0; border-radius: 8px; font-size: .92rem; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); border-color: var(--green); }
textarea { min-height: 100px; resize: vertical; }
.check { display: flex; gap: .5rem; align-items: center; font-size: .88rem; font-weight: 500; }
.check input { width: 16px; height: 16px; }
.help { font-size: .75rem; color: var(--muted); margin-top: .2rem; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 640px; }
th, td { padding: .65rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: var(--bg); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafbfd; }

.flash { padding: .7rem .9rem; border-radius: 8px; margin-bottom: .6rem; font-size: .88rem; border: 1px solid; }
.flash-success { background: var(--green-soft); border-color: #bde8d3; color: #0d6b48; }
.flash-error { background: var(--danger-soft); border-color: #f5c2c2; color: #922; }
.flash-info { background: var(--info-soft); border-color: #c5dbf3; color: #1f4f80; }
.notice { padding: .8rem 1rem; border-radius: 8px; border: 1px solid; font-size: .88rem; margin-bottom: .8rem; }
.notice-warning { background: var(--warning-soft); border-color: #f2dfae; color: #7a5210; }
.notice-info { background: var(--info-soft); border-color: #c5dbf3; color: #1f4f80; }
.notice-success { background: var(--green-soft); border-color: #bde8d3; color: #0d6b48; }
.notice-danger { background: var(--danger-soft); border-color: #f5c2c2; color: #922; }
.notice p:last-child { margin: 0; }

.dl { display: grid; gap: .45rem; }
.dl > div { display: grid; grid-template-columns: 150px 1fr; gap: .6rem; font-size: .88rem; padding-bottom: .45rem; border-bottom: 1px solid var(--line); }
.dl > div:last-child { border-bottom: 0; }
.dl dt { color: var(--muted); font-weight: 600; } .dl dd { font-weight: 600; word-break: break-word; }
.pre { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .8rem; font-size: .85rem; }

.tabs { display: flex; gap: .3rem; overflow-x: auto; margin-bottom: 1rem; padding-bottom: .3rem; }
.tabs a { white-space: nowrap; padding: .45rem .8rem; border-radius: 999px; font-size: .82rem; font-weight: 600; background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.tabs a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tabs a:hover { text-decoration: none; }

.progress { list-style: none; display: grid; gap: .15rem; }
.progress li { display: flex; gap: .6rem; align-items: center; font-size: .88rem; }
.progress .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #cfd6e0; display: inline-flex; align-items: center; justify-content: center; font-size: .65rem; color: #fff; }
.progress li.done .dot { background: var(--green); border-color: var(--green); } .progress li.done .dot::after { content: "✓"; }
.progress li.current .dot { border-color: var(--gold); background: var(--gold); }
.progress li.todo { color: var(--muted); }

.client-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: .8rem; }
.client-head h1 { margin: 0; }
.msg { border-radius: 10px; padding: .7rem .9rem; margin-bottom: .5rem; max-width: 85%; font-size: .88rem; }
.msg-client { background: var(--info-soft); } .msg-admin { background: var(--green-soft); margin-left: auto; }
.msg .meta { font-size: .72rem; color: var(--muted); margin-bottom: .15rem; } .msg p { margin: 0; white-space: pre-wrap; }
.login-wrap { max-width: 400px; margin: 4rem auto; padding: 0 1rem; }
.login-wrap .card { padding: 1.6rem; }
.empty { padding: 1.5rem; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
details.confirm summary { cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--navy); list-style: none; }
details.confirm > div { margin-top: .6rem; padding: .8rem; background: var(--bg); border-radius: 8px; }
