/* Minimal panel styles, visually matching the Starsor admin (colors, font, cards, tables) */
@font-face { font-family: IRANYekanX; font-weight: 400; font-display: swap; src: url("../fonts/IRANYekanX-Regular.woff2") format("woff2"); }
@font-face { font-family: IRANYekanX; font-weight: 500; font-display: swap; src: url("../fonts/IRANYekanX-Medium.woff2") format("woff2"); }
@font-face { font-family: IRANYekanX; font-weight: 700; font-display: swap; src: url("../fonts/IRANYekanX-Bold.woff2") format("woff2"); }

:root {
    --bg: #f4f5f8; --card: #fff; --text: #1c1c25; --muted: #7a8699; --border: #e7e9ee; --line: #eef0f4;
    --primary: #0060ff; --primary-soft: #e8f0ff; --danger: #e5383f; --danger-soft: #feecec;
    --success: #16a085; --success-soft: #e3f6f1; --soft: #f3f5f9; --code: #16161d;
    --shadow: 0 1px 2px rgba(20, 28, 45, .04), 0 2px 8px rgba(20, 28, 45, .04);
    --shadow-lg: 0 12px 40px rgba(20, 28, 45, .1);
    --ring: 0 0 0 3px rgba(0, 96, 255, .18);
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #15151c; --card: #1e1e27; --text: #e9e9ef; --muted: #8b8b99; --border: #2c2c38; --line: #282833;
        --primary: #4d8dff; --primary-soft: #1f2b47; --danger: #ff6b70; --danger-soft: #3d2327;
        --success: #3fc7a8; --success-soft: #19332e; --soft: #272732; --code: #101016;
        --shadow: none; --shadow-lg: 0 12px 40px rgba(0, 0, 0, .4);
        --ring: 0 0 0 3px rgba(77, 141, 255, .28);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.7 IRANYekanX, Tahoma, sans-serif; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.2px; }
.ltr { direction: ltr; text-align: left; unicode-bidi: plaintext; }
.muted { color: var(--muted); font-size: 13px; font-weight: 400; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
:focus-visible { outline: 0; box-shadow: var(--ring); }

/* sidebar */
.sidebar { position: fixed; top: 0; bottom: 0; right: 0; width: 260px; display: flex; flex-direction: column; background: var(--card); border-left: 1px solid var(--border); padding: 0 14px 16px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; height: 68px; padding: 0 6px; font-weight: 700; font-size: 18px; color: var(--text); flex-shrink: 0; }
.brand::before { content: "!"; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 17px; line-height: 1; }
.nav { flex: 1; }
.nav-title { color: var(--muted); font-size: 12px; margin: 20px 12px 6px; }
.nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; color: var(--text); margin-bottom: 2px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--soft); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.nav a span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .pill { font-size: 11px; line-height: 20px; background: var(--soft); color: var(--muted); border-radius: 20px; padding: 0 8px; }
.nav a.active .pill { background: var(--primary); color: #fff; }
.sidebar form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar form .btn { width: 100%; justify-content: center; }

.main { margin-right: 260px; padding: 28px 32px; min-width: 0; max-width: 1500px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }

@media (max-width: 900px) {
    .sidebar { position: static; width: auto; border-left: 0; border-bottom: 1px solid var(--border); max-height: none; }
    .main { margin-right: 0; padding: 16px; }
}

/* cards, tables */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; margin: 0 -8px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 12px; background: var(--soft); white-space: nowrap; }
th:first-child { border-radius: 0 10px 10px 0; }
th:last-child { border-radius: 10px 0 0 10px; }
td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; transition: background .15s; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--soft); }
tbody tr:hover td:first-child { border-radius: 0 10px 10px 0; }
tbody tr:hover td:last-child { border-radius: 10px 0 0 10px; }
td > a:first-child { font-weight: 500; }
.truncate { overflow: hidden; max-width: 0; }
tr.resolved .truncate { opacity: .5; }
.clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty, tbody tr:hover td.empty { text-align: center; color: var(--muted); padding: 48px 0; background: none; }

.badge { display: inline-block; border-radius: 20px; padding: 1px 10px; font-size: 12px; font-weight: 500; background: var(--primary-soft); color: var(--primary); }
.badge.red { background: var(--danger-soft); color: var(--danger); }

/* forms, buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 7px 16px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; background: var(--primary); color: #fff; white-space: nowrap; transition: background .15s, color .15s, border-color .15s, filter .15s, transform .1s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn.light { background: var(--card); color: var(--text); border-color: var(--border); }
.btn.light:hover { background: var(--soft); filter: none; }
.btn.danger { background: var(--danger); }
.btn.danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn.danger-soft:hover { background: var(--danger); color: #fff; filter: none; }
.btn.success-soft { background: var(--success-soft); color: var(--success); }
.btn.sm { padding: 3px 10px; font-size: 12px; border-radius: 8px; }
.input { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 10px; padding: 6px 12px; font: inherit; min-width: 0; transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: var(--muted); }
.input:hover { border-color: var(--muted); }
.input:focus { outline: 0; border-color: var(--primary); box-shadow: var(--ring); }
input[type="checkbox"] { accent-color: var(--primary); vertical-align: middle; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .input { flex: 1; }
.inline { display: inline; }

.alert { border: 1px solid transparent; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; background: var(--success-soft); color: var(--success); font-weight: 500; }
.alert.error { background: var(--danger-soft); color: var(--danger); }

/* project key box */
.key { display: flex; gap: 6px; align-items: center; }
.key code { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; direction: ltr; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; font-size: 12px; }

/* fault details */
.details { display: grid; grid-template-columns: 140px 1fr; }
.details dt, .details dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.details dt { color: var(--muted); font-size: 13px; }
.details dd { margin: 0; word-break: break-all; }
.details dt:first-of-type, .details dd:first-of-type { padding-top: 0; }
.details dt:last-of-type, .details dd:last-of-type { padding-bottom: 0; border-bottom: 0; }
pre.trace { background: var(--code); color: #dfe1ea; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; overflow-x: auto; direction: ltr; text-align: left; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.8; margin: 0; white-space: pre; }
@media (max-width: 600px) {
    .details { grid-template-columns: 1fr; }
    .details dt { padding-bottom: 0; border-bottom: 0; }
    .details dd, .details dd:first-of-type { padding-top: 2px; }
    .details dt:first-of-type { padding-top: 0; }
}

/* small screens: each row becomes a block so the table never scrolls sideways */
@media (max-width: 600px) {
    .stack, .stack tbody { display: block; }
    .stack thead { display: none; }
    .stack tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px; border-bottom: 1px solid var(--line); }
    .stack tr:last-child { border-bottom: 0; }
    .stack td { padding: 0; border: 0; }
    .stack td.truncate, .stack td.empty { flex: 0 0 100%; max-width: 100%; }
}

/* pagination */
.pagination { display: flex; gap: 4px; justify-content: center; list-style: none; padding: 0; margin: 20px 0 0; flex-wrap: wrap; }
.pagination a, .pagination span { display: block; min-width: 34px; text-align: center; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--border); color: var(--text); transition: background .15s; }
.pagination a:hover { background: var(--soft); }
.pagination .active span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled span { border-color: transparent; opacity: .5; }

/* login */
.login { max-width: 400px; margin: 14vh auto; padding: 0 16px; }
.login .card { padding: 32px 28px; border-radius: 20px; box-shadow: var(--shadow-lg); }
.login .input { width: 100%; margin-bottom: 12px; padding: 10px 12px; }
.login .btn { width: 100%; justify-content: center; padding: 10px; }
