:root {
    --border: #000;
    --header-bg: #f0eae0;
    --accent: #7a1f1f;
    --total-bg: #fff6d9;
    /* Nilai skala paparan - laras dengan butang A- / A+ pada dashboard,
       atau tukar nombor ni terus kalau nak tetapkan saiz default. */
    --scale: 1;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: #fff;
    color: #111;
}

.page {
    padding: 16px 20px 32px;
    max-width: 1100px;
    margin: 0 auto;
}

.title-block {
    text-align: center;
    margin-bottom: 14px;
}

.title-block h1 {
    margin: 0;
    font-size: calc(24px * var(--scale));
    letter-spacing: 1px;
    color: var(--accent);
}

.title-block p {
    margin: 4px 0 0;
    font-size: calc(13px * var(--scale));
    color: #444;
}

.table-wrap {
    overflow-x: auto;
}

table.ihaq {
    border-collapse: collapse;
    width: 100%;
    min-width: 640px;
    table-layout: fixed;
}

table.ihaq th,
table.ihaq td {
    border: 2px solid var(--border);
    text-align: center;
    padding: calc(6px * var(--scale)) calc(4px * var(--scale));
    vertical-align: middle;
}

table.ihaq thead th {
    background: var(--header-bg);
    font-size: calc(13px * var(--scale));
    font-weight: 700;
    text-transform: uppercase;
}

table.ihaq thead tr.sub-header th {
    font-size: calc(11px * var(--scale));
}

table.ihaq td.name-cell {
    text-align: left;
    font-weight: 600;
    font-size: calc(11px * var(--scale));
    padding-left: 10px;
    white-space: normal;
}

table.ihaq td.muka-cell {
    font-size: calc(14px * var(--scale));
    font-weight: 700;
    color: var(--accent);
}

table.ihaq td.total-cell {
    font-size: calc(14px * var(--scale));
    font-weight: 800;
    background: var(--total-bg);
}

.legend {
    margin-top: 16px;
    font-size: calc(11px * var(--scale));
    line-height: 1.7;
}

.legend .tag {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    font-weight: 700;
    border: 2px solid var(--border);
    padding: 1px 6px;
    margin-right: 8px;
    background: #fafafa;
}

.clock {
    text-align: right;
    font-size: 13px;
    color: #888;
    margin-bottom: 6px;
}

/* ================= ADMIN ================= */

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

.admin-toolbar a.btn-link {
    text-decoration: none;
}

.btn {
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-half {
    background: #e8f1ff;
    color: #1a4d8f;
}

.btn-one {
    background: #e6f7e6;
    color: #1a6e1a;
}

.btn-minus {
    background: #fff1e0;
    color: #9a5b00;
}

.btn-reset {
    background: #fde8e8;
    color: #a11d1d;
}

.btn:hover {
    filter: brightness(0.94);
}

.btn:active {
    transform: scale(0.96);
}

table.admin td.cell-box {
    padding: 6px;
}

.cell-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.cell-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
    min-height: 28px;
}

.cell-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.cell-buttons button {
    font-size: 12px;
    padding: 4px 7px;
}

.status-msg {
    position: fixed;
    top: 14px;
    right: 14px;
    background: #222;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.25s;
    z-index: 50;
}

.status-msg.show {
    opacity: 1;
}

.top-link-bar {
    text-align: center;
    margin-bottom: 10px;
    font-size: 14px;
}

.top-link-bar a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
