:root {
    color-scheme: dark;
    font-family: "Segoe UI", "Malgun Gothic", sans-serif;
    background: #0d1117;
    color: #eef2f7;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top, rgba(53, 186, 127, 0.15), transparent 38%),
        #0d1117;
}

a { color: inherit; }

.app-shell,
.form-shell {
    width: min(100%, 1120px);
    margin: auto;
}

.form-shell { max-width: 820px; }

.app-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 28px;
}

.app-header .eyebrow { margin-top: 0; }
.app-header .description { margin-bottom: 0; max-width: 720px; }
.header-actions, .card-actions { display: flex; align-items: center; gap: 10px; }
.header-actions form { margin: 0; }
.card-actions form { margin: 0; }

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
}
.button.primary { background: #46c98a; color: #07130d; }
.button.secondary { border-color: #3a4657; background: #161b22; color: #d9e1eb; }
.button.danger { border-color: rgba(255, 120, 120, .55); background: transparent; color: #ff9f9f; }
.button.danger:hover { border-color: #ff7878; background: rgba(255, 90, 90, .08); color: #ffb1b1; }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button.submit { min-width: 220px; margin-top: 18px; }

.notice {
    margin-bottom: 20px; padding: 15px 18px; border: 1px solid rgba(101,217,162,.35);
    border-radius: 12px; background: rgba(70,201,138,.08); color: #8be6b8;
}

.panel {
    margin-bottom: 22px; padding: 24px; border: 1px solid #293240; border-radius: 18px;
    background: rgba(22,27,34,.94);
}
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-title h2 { margin: 0; font-size: 20px; }
.panel-title > span { color: #8b96a5; font-size: 13px; }

.mapping-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 16px; }
.mapping-card { padding: 20px; border: 1px solid #303a48; border-radius: 15px; background: #11161d; }
.mapping-card h3 { margin: 9px 0 18px; font-size: 21px; }
.mapping-card dl { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 8px; margin: 0 0 20px; font-size: 13px; }
.mapping-card dt { color: #7f8b99; }
.mapping-card dd { margin: 0; overflow-wrap: anywhere; color: #cbd4df; }
.tag { display: inline-block; padding: 4px 9px; border-radius: 999px; background: rgba(101,217,162,.12); color: #65d9a2; font-size: 11px; font-weight: 800; }

.empty-state { display: grid; gap: 8px; place-items: center; padding: 42px 20px; color: #8b96a5; text-align: center; }
.history-list { display: grid; }
.history-list > div { display: grid; grid-template-columns: 90px 1fr auto; gap: 14px; padding: 13px 0; border-top: 1px solid #293240; }
.history-list .success { color: #65d9a2; }
.history-list .failure { color: #ff9b9b; }
.history-list time { color: #7f8b99; font-size: 13px; }

.back-link { display: inline-block; margin-bottom: 24px; color: #9ca8b7; text-decoration: none; }
.settings-form { display: grid; gap: 18px; }
.settings-form fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0; padding: 22px; border: 1px solid #293240; border-radius: 16px; background: #161b22; }
.settings-form legend { padding: 0 8px; color: #65d9a2; font-weight: 800; }
.settings-form label { display: grid; gap: 8px; color: #b9c3d0; font-size: 13px; font-weight: 700; }
.settings-form label.wide { grid-column: 1 / -1; }
.settings-form input:not([type=checkbox]), .settings-form select { width: 100%; height: 48px; padding: 0 14px; border: 1px solid #3a4657; border-radius: 11px; background: #0d1117; color: #eef2f7; font: inherit; }
.settings-form input[readonly], .settings-form input:disabled { color: #9ca8b7; background: #131820; }
.settings-form .check { display: flex; grid-auto-flow: column; justify-content: start; align-items: center; gap: 9px; }
.settings-form .check input { width: 18px; height: 18px; accent-color: #46c98a; }
.field-validation-error { color: #ff9b9b; font-size: 12px; }
.profile-note { color: #8b96a5; font-size: 12px; font-weight: 500; }

.path-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.path-input .button { min-width: 104px; white-space: nowrap; }
.folder-dialog { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; background: rgba(5, 8, 12, .78); }
.folder-dialog[hidden] { display: none; }
.folder-dialog-card { width: min(100%, 680px); max-height: min(760px, calc(100vh - 44px)); display: grid; grid-template-rows: auto auto auto auto minmax(120px, 1fr); gap: 14px; padding: 24px; border: 1px solid #354154; border-radius: 20px; background: #11161d; box-shadow: 0 28px 90px rgba(0,0,0,.55); }
.folder-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.folder-dialog-header .eyebrow { margin: 0 0 6px; }
.folder-dialog-header h2 { margin: 0; }
.dialog-close { width: 42px; height: 42px; border: 1px solid #3a4657; border-radius: 11px; background: #161b22; color: #d9e1eb; cursor: pointer; font-size: 25px; }
.folder-current { min-height: 48px; padding: 13px 15px; overflow-wrap: anywhere; border: 1px solid #3a4657; border-radius: 11px; background: #0d1117; color: #eef2f7; font-family: Consolas, monospace; }
.folder-actions { display: flex; justify-content: space-between; gap: 10px; }
.folder-status { min-height: 20px; color: #9ca8b7; font-size: 13px; }
.folder-list { min-height: 120px; overflow-y: auto; border-top: 1px solid #293240; }
.folder-row { width: 100%; padding: 14px 12px; border: 0; border-bottom: 1px solid #293240; background: transparent; color: #dce4ee; cursor: pointer; font: inherit; text-align: left; }
.folder-row:hover { background: rgba(101,217,162,.08); color: #8be6b8; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 24px 0; }
.summary-grid > div { display: grid; gap: 4px; padding: 20px; border: 1px solid #293240; border-radius: 14px; background: #161b22; }
.summary-grid strong { font-size: 30px; }
.summary-grid span { color: #8b96a5; font-size: 12px; }
.file-list { max-height: 480px; overflow: auto; }
.file-list > div { display: grid; grid-template-columns: 90px 1fr auto; gap: 12px; padding: 11px 0; border-top: 1px solid #293240; align-items: center; }
.file-list code { overflow-wrap: anywhere; color: #dce4ee; }
.file-list > div > span:last-child { color: #7f8b99; font-size: 12px; }
.file-kind { font-size: 11px; font-weight: 800; text-transform: uppercase; }
.file-kind.new, .file-kind.changed { color: #65d9a2; }
.file-kind.unchanged { color: #7f8b99; }
.file-kind.missing { color: #eabf72; }

.status-card,
.auth-card {
    width: min(100%, 560px);
    padding: 48px;
    border: 1px solid #293240;
    border-radius: 24px;
    background: rgba(22, 27, 34, 0.94);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.auth-card {
    width: min(100%, 460px);
}

.auth-card .eyebrow {
    margin-top: 0;
}

.pin-form {
    display: grid;
    gap: 12px;
}

.pin-form label {
    color: #c7d0dc;
    font-size: 14px;
    font-weight: 700;
}

.pin-form input {
    width: 100%;
    height: 58px;
    padding: 0 18px;
    border: 1px solid #3a4657;
    border-radius: 14px;
    outline: none;
    background: #0d1117;
    color: #eef2f7;
    font: inherit;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-align: center;
}

.pin-form input:focus {
    border-color: #65d9a2;
    box-shadow: 0 0 0 3px rgba(101, 217, 162, 0.14);
}

.pin-form button {
    height: 54px;
    margin-top: 10px;
    border: 0;
    border-radius: 14px;
    background: #46c98a;
    color: #07130d;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.pin-form button:hover {
    background: #65d9a2;
}

.alert {
    margin: -10px 0 20px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 120, 120, 0.35);
    border-radius: 12px;
    background: rgba(255, 90, 90, 0.08);
    color: #ffb1b1;
    line-height: 1.5;
}

.alert:empty {
    display: none;
}

.status-mark {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #2ea66f;
    color: #07130d;
    font-size: 30px;
    font-weight: 800;
}

.eyebrow {
    margin: 28px 0 8px;
    color: #65d9a2;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
}

h1 {
    margin: 0;
    font-size: clamp(30px, 6vw, 44px);
    line-height: 1.15;
}

.description {
    margin: 18px 0 32px;
    color: #aeb8c6;
    line-height: 1.7;
}

.status-list {
    margin: 0;
    border-top: 1px solid #293240;
}

.status-list div {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid #293240;
}

.status-list dt {
    color: #8b96a5;
}

.status-list dd {
    margin: 0;
    font-weight: 700;
}

.status-list .online {
    color: #65d9a2;
}

@media (max-width: 560px) {
    .status-card,
    .auth-card {
        padding: 32px 24px;
        border-radius: 18px;
    }

    .app-header { display: grid; }
    .settings-form fieldset { grid-template-columns: 1fr; }
    .settings-form label.wide { grid-column: auto; }
    .path-input { grid-template-columns: 1fr; }
    .folder-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .summary-grid { grid-template-columns: 1fr 1fr; }
    .history-list > div, .file-list > div { grid-template-columns: 72px 1fr; }
    .history-list time, .file-list > div > span:last-child { grid-column: 2; }
}
