﻿:root {
    --bg: #08111f;
    --panel: rgba(11, 18, 32, 0.78);
    --panel-strong: rgba(15, 23, 42, 0.92);
    --line: rgba(148, 163, 184, 0.18);
    --text: #e5eefb;
    --muted: #8da3c1;
    --accent: #f97316;
    --accent-soft: rgba(249, 115, 22, 0.14);
    --good: #22c55e;
    --warn: #f59e0b;
    --danger: #f43f5e;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
    --radius: 24px;
    --font: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 32%),
        radial-gradient(circle at top right, rgba(249, 115, 22, 0.12), transparent 28%),
        linear-gradient(180deg, #09111f 0%, #050a14 100%);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
}

.topbar, .tabbar, .panel, .modal-card {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    padding: 10px;
}

.eyebrow {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; }
h2 { font-size: 24px; }
h3 { font-size: 16px; }

.header-actions, .toolbar, .modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tabbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 22px;
    padding: 10px;
    background: rgba(8, 16, 30, 0.62);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.tab-btn, .ghost-btn, .primary-btn, .icon-btn {
    border: 1px solid transparent;
    border-radius: 999px;
    transition: 0.18s ease;
}

.tab-btn {
    padding: 13px 16px;
    background: transparent;
    color: var(--muted);
}
.tab-btn.active {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.98), rgba(251, 146, 60, 0.92));
    color: #fff7ed;
}

.ghost-btn, .primary-btn, .icon-btn {
    padding: 11px 16px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-color: var(--line);
}
.ghost-btn:hover, .icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}
.primary-btn {
    background: linear-gradient(135deg, #f97316, #fb923c);
    color: white;
    border-color: rgba(255, 255, 255, 0.08);
}
.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(249, 115, 22, 0.28);
}
.icon-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
}

.view-stack { display: grid; gap: 20px; }
.view { display: none; gap: 18px; }
.view.active { display: grid; }
.view-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
}

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

.schedule-layout {
    display: grid;
    grid-template-columns: minmax(320px, 1.1fr) minmax(320px, 0.9fr);
    gap: 18px;
}

.timeline-panel {
    min-height: 620px;
}

.ring-wrap {
    min-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ring-svg {
    width: min(100%, 560px);
    aspect-ratio: 1;
    overflow: visible;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric-card {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}
.metric-card .label { font-size: 12px; color: var(--muted); }
.metric-card .value { margin-top: 6px; font-size: 24px; font-weight: 700; }

.card-list, .master-grid, .board-grid, .calendar-grid {
    display: grid;
    gap: 14px;
}

.card-item, .master-card, .task-card, .calendar-day, .lane {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.035);
}

.card-item, .master-card, .task-card {
    padding: 16px;
}

.card-item.selected {
    border-color: rgba(249, 115, 22, 0.58);
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.24);
}

.card-meta, .task-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.note-line {
    margin-top: 10px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.board-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lane-list {
    display: grid;
    gap: 14px;
    min-height: 120px;
}

.lane {
    padding: 14px;
    min-height: 340px;
}

.lane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.task-card { display: grid; gap: 8px; }
.task-card .actions, .master-card .actions, .card-item .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.progress-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.progress-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f97316, #fb923c);
}

.master-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.master-lane {
    min-height: 280px;
}

.drag-handle {
    touch-action: none;
}

.drop-list.drop-target {
    border-radius: 18px;
    outline: 1px dashed rgba(249, 115, 22, 0.62);
    outline-offset: 6px;
}

.drag-placeholder {
    border: 1px dashed rgba(249, 115, 22, 0.68);
    border-radius: 18px;
    background: rgba(249, 115, 22, 0.08);
}

.drag-ghost {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1200;
    pointer-events: none;
    opacity: 0.94;
    transform: translate(-9999px, -9999px);
    box-shadow: 0 24px 48px rgba(2, 6, 23, 0.38);
}

body.drag-active {
    user-select: none;
    overscroll-behavior: none;
}

.drag-origin {
    opacity: 0.4;
}

.calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekday, .calendar-day {
    padding: 12px;
    min-height: 118px;
}
.calendar-weekday {
    color: var(--muted);
    text-align: center;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.calendar-day.today {
    border-color: rgba(249, 115, 22, 0.5);
    box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.25);
}
.calendar-day .day-num {
    font-weight: 700;
    margin-bottom: 10px;
}
.calendar-day .counts {
    display: grid;
    gap: 6px;
}

.month-label {
    min-width: 120px;
    text-align: center;
    font-weight: 700;
}

.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid label {
    display: grid;
    gap: 6px;
    color: var(--muted);
}
.form-grid label span { font-size: 13px; }
.form-grid input,
.form-grid select,
.form-grid textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}
.form-grid textarea { resize: vertical; }
.full-width { grid-column: 1 / -1; }

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(2, 6, 23, 0.54);
    z-index: 20;
    overflow-y: auto;
}
.modal.hidden, .toast.hidden { display: none; }
.modal-card {
    width: min(720px, 100%);
    padding: 20px;
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    max-height: min(92dvh, 920px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex: 0 0 auto;
}

.modal-card .form-grid {
    overflow-y: auto;
    padding-right: 4px;
}

.modal-actions {
    position: sticky;
    bottom: 0;
    justify-content: flex-end;
    padding-top: 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.96) 35%);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    padding: 12px 18px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid var(--line);
    z-index: 30;
    box-shadow: var(--shadow);
}

.empty-state {
    padding: 30px 16px;
    text-align: center;
    color: var(--muted);
}

.ring-caption {
    font-size: 12px;
    fill: #8da3c1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.ring-main {
    font-size: 36px;
    font-weight: 700;
    fill: #eff6ff;
}
.ring-sub {
    font-size: 15px;
    fill: #9fb1c7;
}

@media (max-width: 980px) {
    .schedule-layout,
    .board-grid,
    .master-grid {
        grid-template-columns: 1fr;
    }
    .calendar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .app-shell { padding: 16px; }
    .topbar {
        padding: 16px;
        align-items: start;
        flex-direction: column;
    }
    .tabbar {
        position: sticky;
        top: 10px;
        z-index: 10;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        border-radius: 26px;
    }
    .view-head {
        align-items: stretch;
    }
    .toolbar {
        width: 100%;
    }
    .toolbar > * {
        flex: 1 1 140px;
    }
    .timeline-panel {
        min-height: auto;
    }
    .ring-wrap {
        min-height: 380px;
    }
    .form-grid,
    .calendar-grid {
        grid-template-columns: 1fr;
    }
    .modal {
        align-items: end;
        padding: 0;
    }
    .modal-card {
        width: 100%;
        border-radius: 28px 28px 0 0;
        max-height: min(94dvh, calc(100dvh - 6px));
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }
}

.hidden { display: none !important; }

.auth-badge {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

body.auth-locked {
    overflow: hidden;
}

body.auth-locked .app-shell {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(3, 7, 18, 0.58);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.auth-card {
    width: min(100%, 420px);
    padding: 28px;
    border-radius: 28px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(8, 16, 30, 0.88);
    box-shadow: var(--shadow);
}

.auth-copy {
    margin-top: 10px;
    color: var(--muted);
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.auth-form label,
.setup-hint {
    display: grid;
    gap: 8px;
}

.auth-form input {
    width: 100%;
}

.setup-hint {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(249, 115, 22, 0.22);
    background: rgba(249, 115, 22, 0.08);
    color: #fed7aa;
    line-height: 1.6;
}

.setup-hint code {
    word-break: break-word;
    font-family: Consolas, "Courier New", monospace;
    color: #fff7ed;
}

@media (max-width: 720px) {
    .auth-card {
        padding: 22px;
        border-radius: 24px;
    }

    .auth-badge {
        width: 100%;
        justify-content: center;
    }
}
