/*
 * 檔案：server/public/assets/app.css
 * 修改日期：2026-10-06T08:11:14+08:00（UTC+8）
 * 版本：後台 0.2.0
 * 用途：後台基本版面樣式。
 * 修改摘要：依 TPWDS 2.1.0 擴充原版；TVBOX 播放器版本維持 0.1.0。
 */

:root {
    --ink: #183342;
    --muted: #657984;
    --teal: #246e71;
    --line: #dce4e7;
    --bg: #f4f7f8;
    --gold: #c69948;
    --sidebar: #17333e;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font:
        16px/1.65 "Noto Sans CJK TC",
        "Microsoft JhengHei",
        sans-serif;
}
button,
input,
select,
textarea {
    font: inherit;
}
button,
.button {
    border: 0;
    background: var(--teal);
    color: white;
    border-radius: 7px;
    padding: 10px 19px;
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
    line-height: 1.45;
}
button:hover {
    filter: brightness(0.94);
}
button:disabled {
    opacity: 0.5;
    cursor: wait;
}
button.secondary {
    background: white;
    color: var(--ink);
    border: 1px solid var(--line);
}
button.danger {
    background: #a53838;
}
button.small {
    font-size: 14px;
    padding: 7px 12px;
}
input,
select,
textarea {
    width: 100%;
    border: 1px solid #bdcdd2;
    border-radius: 6px;
    padding: 10px 12px;
    background: white;
    color: var(--ink);
}
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #c4e3e0;
    outline-offset: 1px;
}
textarea {
    min-height: 110px;
    resize: vertical;
}
label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin: 13px 0;
}
label input,
label textarea,
label select {
    margin-top: 5px;
    font-weight: 400;
}
.eyebrow {
    font-size: 13px;
    letter-spacing: 0.1em;
    margin: 0 0 6px;
    color: var(--teal);
    font-weight: 700;
}
h1 {
    font-size: 28px;
    line-height: 1.35;
    margin: 0 0 12px;
}
h2 {
    font-size: 21px;
    line-height: 1.5;
    margin: 0 0 14px;
}
p {
    margin: 10px 0;
}
.muted {
    color: var(--muted);
    font-size: 14px;
}
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-panel,
.install-panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 36px;
    width: min(100%, 450px);
    box-shadow: 0 12px 38px #1430390a;
}
.login-panel button {
    width: 100%;
    margin-top: 15px;
}
.install-page {
    padding: 30px 16px;
}
.install-panel {
    width: min(100%, 790px);
    margin: 0 auto;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 18px;
}
.notice {
    padding: 15px;
    background: #e9f4f2;
    border: 1px solid #c0dcd7;
    border-radius: 6px;
}
.sidebar {
    width: 245px;
    position: fixed;
    inset: 0 auto 0 0;
    background: var(--sidebar);
    color: #edf4f3;
    display: flex;
    flex-direction: column;
    padding: 24px 17px;
    z-index: 30;
}
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    color: white;
    text-decoration: none;
    font-size: 17px;
    margin-bottom: 33px;
    font-weight: 600;
}
.brand-icon {
    display: grid;
    place-items: center;
    width: 39px;
    height: 42px;
    border: 1px solid #719a9c;
    border-radius: 6px;
    color: #e2c787;
    font-size: 22px;
}
.brand small {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #a9c0c4;
}
.sidebar nav {
    display: grid;
    gap: 5px;
}
.sidebar button {
    color: #cad9dc;
    background: none;
    text-align: left;
    width: 100%;
    font-size: 15px;
    padding: 11px 16px;
}
.sidebar button.active {
    color: white;
    background: #2d505b;
}
.sidebar .welcome-nav {
    color: #f4d697;
}
.sidebar-bottom {
    margin-top: auto;
    border-top: 1px solid #34555f;
    padding-top: 16px;
}
.workspace {
    margin-left: 245px;
}
.topbar {
    background: white;
    border-bottom: 1px solid var(--line);
    height: 82px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 32px;
}
.tenant-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: var(--muted);
}
.tenant-label select {
    width: 230px;
    margin: 0;
}
.topbar #account-name {
    margin-left: auto;
    font-size: 14px;
}
.main-content {
    padding: 30px 32px 50px;
    max-width: 1750px;
    margin: auto;
}
.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}
.page-heading h1 {
    margin-bottom: 0;
}
.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.toolbar input {
    max-width: 320px;
}
.panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 24px;
}
.table-wrap {
    overflow: auto;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    text-align: left;
}
th {
    background: #edf3f4;
    color: #48616c;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
td,
th {
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
}
tr:last-child td {
    border-bottom: 0;
}
tbody tr:hover {
    background: #f9fbfb;
}
.actions-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.empty {
    padding: 50px 20px;
    text-align: center;
    color: var(--muted);
    background: white;
    border: 1px dashed #c9d9dc;
    border-radius: 8px;
}
.badge {
    display: inline-block;
    padding: 3px 9px;
    font-size: 12px;
    background: #edf3f5;
    border-radius: 5px;
    white-space: nowrap;
}
.badge.online {
    background: #e0f1e8;
    color: #236444;
}
.badge.offline {
    background: #f2eeee;
    color: #7c6464;
}
.overview-counts {
    display: flex;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.overview-counts > div {
    flex: 1;
    padding: 22px;
    min-width: 150px;
    border-right: 1px solid var(--line);
}
.overview-counts strong {
    font-size: 27px;
    display: block;
}
.overview-counts span {
    color: var(--muted);
    font-size: 14px;
}
.instructions {
    padding: 20px 26px;
    background: #eaf3f2;
    border-left: 4px solid var(--teal);
    margin: 20px 0;
}
dialog {
    border: 0;
    border-radius: 12px;
    padding: 0;
    width: min(980px, calc(100% - 30px));
    max-height: 90vh;
    color: var(--ink);
    box-shadow: 0 20px 80px #0005;
}
dialog::backdrop {
    background: #112c3b80;
}
.modal-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 26px;
    border-bottom: 1px solid var(--line);
}
.modal-heading h2 {
    margin: 0;
}
#modal-body {
    padding: 6px 26px 20px;
    max-height: 65vh;
    overflow: auto;
}
.modal-footer {
    padding: 16px 26px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.form-error,
#login-error {
    color: #a33838;
    margin: 10px 26px;
    font-size: 14px;
}
.icon-button {
    padding: 5px 12px;
    font-size: 23px;
    line-height: 1;
}
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #183642;
    color: white;
    border-radius: 7px;
    padding: 12px 24px;
    z-index: 100;
    display: none;
    max-width: 90vw;
}
#menu-toggle {
    display: none;
}
.welcome-layout {
    display: grid;
    grid-template-columns: minmax(330px, 1fr) minmax(300px, 1fr);
    gap: 28px;
}
.welcome-preview {
    width: 100%;
    min-height: 350px;
    max-height: 600px;
    aspect-ratio: 16/9;
    border: 6px solid #17323b;
    background: #781f28;
    color: #ffd778;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    border-radius: 6px;
}
.welcome-preview.portrait {
    aspect-ratio: 9/16;
    max-width: 310px;
    margin: auto;
    min-height: 480px;
}
.welcome-text {
    white-space: pre-wrap;
    font-weight: bold;
    line-height: 1.7;
    font-size: clamp(18px, 2.3vw, 42px);
    overflow-wrap: anywhere;
}
.welcome-preview.portrait .welcome-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    max-height: 420px;
    max-width: 240px;
    letter-spacing: 0.2em;
    font-size: 25px;
    line-height: 1.8;
}
.editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 22px;
}
.editor-stage {
    background: #e7edef;
    border-radius: 7px;
    padding: 18px;
    align-self: start;
}
.canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #172c3d;
    overflow: hidden;
    touch-action: none;
    max-height: 650px;
}
.canvas.portrait {
    aspect-ratio: 9/16;
    max-width: 330px;
    margin: auto;
}
.region {
    position: absolute;
    overflow: hidden;
    background: #315866;
    color: white;
    border: 2px solid #ffffff80;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px;
    font-size: 14px;
    user-select: none;
}
.region.selected {
    border-color: #edc871;
    outline: 2px solid #edc871;
    outline-offset: -4px;
}
.region-label {
    pointer-events: none;
    text-align: center;
    white-space: pre-wrap;
}
.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 19px;
    height: 19px;
    background: #edc871;
    cursor: nwse-resize;
}
.properties {
    background: #fafcfc;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
}
.properties .form-grid {
    gap: 0 10px;
}
.properties input,
.properties select {
    font-size: 13px;
    padding: 7px;
}
.properties label {
    font-size: 12px;
    margin: 8px 0;
}
.region-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 14px 0;
}
.region-list button {
    font-size: 12px;
    padding: 5px 9px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
}
.checkbox-label input {
    width: auto;
    margin: 0;
}
.table-preview-image {
    width: 65px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}
.tenant-empty {
    margin-bottom: 20px;
}
.welcome-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}
[hidden] {
    display: none !important;
}
@media (max-width: 1050px) {
    .sidebar {
        width: 205px;
    }
    .workspace {
        margin-left: 205px;
    }
    .main-content {
        padding: 24px 20px;
    }
    .topbar {
        padding: 12px 20px;
    }
    .welcome-layout {
        grid-template-columns: 1fr;
    }
    .editor {
        grid-template-columns: 1fr;
    }
    .properties .form-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (max-width: 760px) {
    .sidebar {
        display: none;
        width: 240px;
    }
    .sidebar.open {
        display: flex;
    }
    .workspace {
        margin-left: 0;
    }
    #menu-toggle {
        display: block;
    }
    .topbar {
        gap: 10px;
        height: 74px;
    }
    .tenant-label {
        font-size: 0;
    }
    .tenant-label select {
        width: 190px;
        font-size: 14px;
    }
    #account-name {
        max-width: 110px;
        overflow: hidden;
    }
    .main-content {
        padding: 22px 14px;
    }
    .page-heading {
        align-items: start;
    }
    .page-heading h1 {
        font-size: 23px;
    }
    .page-heading button {
        font-size: 13px;
    }
    .form-grid,
    .properties .form-grid {
        grid-template-columns: 1fr 1fr;
    }
    .login-panel {
        padding: 28px;
    }
    .welcome-layout {
        display: block;
    }
    .welcome-preview {
        margin-top: 24px;
    }
    .panel {
        padding: 18px;
    }
    td,
    th {
        padding: 12px 13px;
    }
    .overview-counts > div {
        padding: 16px;
        min-width: 50%;
    }
}
