:root {
    color-scheme: light;
    font-family: "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
    --ink: #17202a;
    --muted: #667085;
    --line: #d8dee8;
    --surface: #ffffff;
    --page: #f3f6f8;
    --primary: #116c7b;
    --primary-dark: #0b4f5b;
    --accent: #c4572d;
    --ok: #237a4b;
    --shadow: 0 12px 32px rgba(25, 35, 45, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--ink);
}

.app-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    padding: 32px clamp(20px, 4vw, 56px) 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
}

h2 {
    font-size: 1.2rem;
}

.status-pill {
    flex: 0 0 auto;
    padding: 8px 14px;
    border: 1px solid #a8c9cf;
    border-radius: 999px;
    color: var(--primary-dark);
    font-weight: 700;
    background: #eef8f9;
}

.layout {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 24px;
    padding: 24px clamp(20px, 4vw, 56px) 56px;
}

.public-layout {
    padding: 24px clamp(20px, 4vw, 56px) 56px;
}

.login-layout {
    display: grid;
    place-items: start center;
    padding: 40px clamp(20px, 4vw, 56px) 56px;
}

.notice-board {
    max-width: 1080px;
    margin: 0 auto;
}

.login-panel {
    width: min(100%, 420px);
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-form {
    display: grid;
    gap: 12px;
}

.login-form label {
    color: var(--muted);
    font-weight: 700;
}

.login-form input {
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}

.login-form input:focus {
    outline: 3px solid #cde8ec;
    border-color: var(--primary);
}

.upload-panel,
.training-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.upload-panel {
    align-self: start;
    padding: 22px;
}

.drop-zone {
    display: grid;
    gap: 8px;
    place-items: center;
    min-height: 170px;
    padding: 22px;
    border: 2px dashed #9eb0bd;
    border-radius: 8px;
    background: #f8fafb;
    text-align: center;
    cursor: pointer;
}

.drop-zone:focus-within,
.drop-zone.is-dragover {
    border-color: var(--primary);
    background: #eef8f9;
}

.drop-zone input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
}

.drop-title {
    font-weight: 800;
    color: var(--primary-dark);
}

.drop-subtitle,
.form-message,
.empty-state,
.summary {
    color: var(--muted);
}

.file-list {
    display: grid;
    gap: 8px;
    margin: 14px 0;
}

.file-chip {
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfd;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

button {
    font: inherit;
}

.primary-button,
.ghost-button,
.icon-button {
    border-radius: 6px;
    cursor: pointer;
}

.primary-button {
    width: 100%;
    min-height: 44px;
    border: 0;
    background: var(--primary);
    color: white;
    font-weight: 800;
}

a.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.primary-button:hover {
    background: var(--primary-dark);
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.section-heading,
.card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.section-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.ghost-button {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
}

.compact-button {
    flex: 0 0 auto;
    min-height: 34px;
}

.ghost-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
}

.status-tabs {
    display: inline-flex;
    gap: 6px;
    margin: 18px 0 16px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eef2f5;
}

.status-tab {
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.status-tab.is-active {
    background: var(--surface);
    color: var(--primary-dark);
    box-shadow: 0 1px 4px rgba(25, 35, 45, 0.12);
}

.status-tab span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6em;
    margin-left: 4px;
    color: inherit;
}

.search-tools {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr);
    gap: 12px;
    margin: 0 0 16px;
}

.search-tools label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 800;
}

.search-tools input {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-weight: 500;
}

.search-tools input:focus {
    outline: 3px solid #cde8ec;
    border-color: var(--primary);
}

.training-list {
    display: grid;
    gap: 16px;
}

.training-card {
    padding: 20px;
}

.training-card.is-expired {
    border-color: #c8ced6;
    background: #f8fafb;
}

.training-card h3 {
    flex: 1 1 auto;
    margin-bottom: 0;
    font-size: 1.18rem;
    line-height: 1.35;
}

.edit-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.edit-form-heading,
.edit-field-wide,
.edit-actions {
    grid-column: 1 / -1;
}

.edit-form-heading h3 {
    margin-bottom: 0;
}

.edit-field {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

.edit-field input,
.edit-field textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    font: inherit;
    font-weight: 500;
}

.edit-field textarea {
    min-height: 96px;
    resize: vertical;
}

.edit-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.edit-save-button {
    width: auto;
    padding: 0 18px;
}

.icon-button {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: #fff;
    color: #a03c23;
    font-size: 1.3rem;
    line-height: 1;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    margin: 16px 0;
}

.meta-grid div {
    min-width: 0;
}

dt {
    color: var(--muted);
    font-size: 0.78rem;
}

dd {
    margin: 3px 0 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.summary {
    margin-bottom: 12px;
    line-height: 1.7;
}

.notes {
    margin: 0 0 14px;
    padding-left: 1.2rem;
    color: #344054;
}

.attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-link {
    padding: 7px 10px;
    border: 1px solid #b9ccd1;
    border-radius: 6px;
    color: var(--primary-dark);
    background: #f3fafb;
    text-decoration: none;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.email-log-panel {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.email-log-panel h4 {
    margin: 0 0 8px;
    font-size: 0.95rem;
}

.email-log-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.email-log-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 1.25rem;
}

.email-log-item {
    color: #344054;
    font-size: 0.9rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.email-log-item.is-failed {
    color: #b42318;
}

.empty-state {
    padding: 36px 20px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #fff;
    text-align: center;
}

.is-error {
    color: #b42318;
}

.is-success {
    color: var(--ok);
}

@media (max-width: 860px) {
    .app-header {
        align-items: start;
        flex-direction: column;
    }

    .top-actions {
        justify-content: flex-start;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .meta-grid,
    .search-tools,
    .edit-form {
        grid-template-columns: 1fr;
    }
}
