/*
 * 檔案名稱：assets/css/app.css
 * 修改日期：2026/07/25 21:49（UTC+8）
 * 檔案用途：多站台流量回報中心前後台共用響應式樣式
 * 修改說明：新增 CSP 相容圖表高度級距並維持響應式版面
 */

:root {
    --ink: #16202a;
    --muted: #667482;
    --bg: #f4f7fa;
    --panel: #ffffff;
    --line: #dce4ea;
    --brand: #0d6b7a;
    --brand-deep: #07434d;
    --soft: #dff2f4;
    --danger: #a63d4b;
    --warning: #a66a16;
    --success: #28745a;
    --shadow: 0 18px 52px rgba(18, 43, 57, 0.10);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;

    color: var(--ink);
    background: var(--bg);

    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    line-height: 1.65;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.button {
    white-space: nowrap;
}

code {
    overflow-wrap: anywhere;
}

.shell {
    width: min(calc(100% - 34px), 1240px);
    margin: 0 auto;
}

.install-shell {
    max-width: 900px;
}

.topbar {
    position: sticky;
    z-index: 50;
    top: 0;

    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    gap: 20px;
}

.brand,
.topbar nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    font-weight: 900;
}

.brand-mark {
    display: grid;
    place-items: center;

    width: 40px;
    height: 40px;

    color: #ffffff;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;

    color: #ffffff;
    border: 0;
    border-radius: 12px;
    background: var(--brand);

    font-weight: 800;
    cursor: pointer;
}

.button:hover,
.button:focus-visible {
    filter: brightness(0.96);
}

.button.small {
    min-height: 36px;
    padding: 7px 13px;

    font-size: 0.9rem;
}

.button.secondary {
    color: var(--brand-deep);
    border: 1px solid var(--line);
    background: #ffffff;
}

.button.danger {
    background: var(--danger);
}

.button-full {
    width: 100%;
}

.page {
    padding: 34px 0 70px;
}

.admin-nav {
    margin-bottom: 24px;
}

.heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 22px;
}

.heading-compact {
    align-items: start;
    margin-bottom: 12px;
}

h1,
h2,
h3 {
    line-height: 1.25;
}

.heading h1 {
    margin: 0;

    font-size: clamp(2rem, 4vw, 3.2rem);
}

.heading p {
    margin: 8px 0 0;

    color: var(--muted);
}

.panel,
.stat,
.site-card {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.panel {
    padding: 24px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat {
    padding: 20px;
}

.stat span {
    color: var(--muted);
}

.stat strong {
    display: block;
    margin-top: 8px;

    font-size: 2rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.site-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.site-card {
    padding: 22px;
}

.site-card h3 {
    margin: 0;
}

.section-gap {
    margin-top: 20px;
}

.section-bottom {
    margin-bottom: 22px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 3px 10px;

    color: var(--brand-deep);
    border-radius: 999px;
    background: var(--soft);

    font-size: 0.82rem;
    font-weight: 800;
}

.badge.success {
    color: #205b47;
    background: #dff3e9;
}

.badge.warning {
    color: #794a10;
    background: #fff0d4;
}

.badge.danger {
    color: #7f2c38;
    background: #f9dfe4;
}

.field {
    display: grid;
    gap: 7px;
    margin-bottom: 15px;
}

.field label {
    font-weight: 800;
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;

    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--brand);
    outline: 3px solid rgba(13, 107, 122, 0.12);
}

.textarea {
    min-height: 120px;
    resize: vertical;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.full {
    grid-column: 1 / -1;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.actions form {
    margin: 0;
}

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

table {
    width: 100%;

    border-collapse: collapse;
}

th,
td {
    padding: 13px 12px;

    border-bottom: 1px solid var(--line);

    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);

    font-size: 0.87rem;
}

.notice {
    padding: 16px;

    color: #744812;
    border-radius: 14px;
    background: #fff0d4;
}

.notice ul {
    margin: 0;
    padding-left: 1.3rem;
}

.notice-error {
    color: #7f2c38;
    background: #f9dfe4;
}

.notice-success {
    color: #205b47;
    background: #dff3e9;
}

.secret-box {
    padding: 20px;

    border: 2px dashed var(--brand);
    border-radius: 16px;
    background: var(--soft);

    word-break: break-all;
}

.chart {
    display: flex;
    align-items: end;
    gap: 8px;
    min-height: 220px;
    padding-top: 20px;
}

.chart-column {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: end;
    gap: 8px;
    min-width: 34px;
}

.chart-bar {
    width: 100%;
    min-height: 3px;

    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, #33a0ad, var(--brand));
}

.chart-label {
    color: var(--muted);

    font-size: 0.78rem;
    writing-mode: vertical-rl;
}

.chart-height-1 {
    height: 5px;
}

.chart-height-2 {
    height: 10px;
}

.chart-height-3 {
    height: 15px;
}

.chart-height-4 {
    height: 20px;
}

.chart-height-5 {
    height: 25px;
}

.chart-height-6 {
    height: 30px;
}

.chart-height-7 {
    height: 35px;
}

.chart-height-8 {
    height: 40px;
}

.chart-height-9 {
    height: 45px;
}

.chart-height-10 {
    height: 50px;
}

.chart-height-11 {
    height: 55px;
}

.chart-height-12 {
    height: 60px;
}

.chart-height-13 {
    height: 65px;
}

.chart-height-14 {
    height: 70px;
}

.chart-height-15 {
    height: 75px;
}

.chart-height-16 {
    height: 80px;
}

.chart-height-17 {
    height: 85px;
}

.chart-height-18 {
    height: 90px;
}

.chart-height-19 {
    height: 95px;
}

.chart-height-20 {
    height: 100px;
}

.chart-height-21 {
    height: 105px;
}

.chart-height-22 {
    height: 110px;
}

.chart-height-23 {
    height: 115px;
}

.chart-height-24 {
    height: 120px;
}

.chart-height-25 {
    height: 125px;
}

.chart-height-26 {
    height: 130px;
}

.chart-height-27 {
    height: 135px;
}

.chart-height-28 {
    height: 140px;
}

.chart-height-29 {
    height: 145px;
}

.chart-height-30 {
    height: 150px;
}

.chart-height-31 {
    height: 155px;
}

.chart-height-32 {
    height: 160px;
}

.chart-height-33 {
    height: 165px;
}

.chart-height-34 {
    height: 170px;
}

.chart-height-35 {
    height: 175px;
}

.chart-height-36 {
    height: 180px;
}


.login {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 72px);
    padding: 30px;
}

.login-card {
    width: min(100%, 480px);
}

.empty {
    padding: 50px 20px;

    color: var(--muted);

    text-align: center;
}

.sr-only {
    position: absolute;

    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;

    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 960px) {
    .stats,
    .site-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .stats,
    .site-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .heading,
    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-inner {
        padding: 12px 0;
    }

    .chart {
        overflow-x: auto;
    }

    .chart-column {
        flex: 0 0 40px;
    }
}
