* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1419;
    color: #e7e9ea;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
}

header {
    text-align: center;
    padding: 20px 0 10px;
}

header h1 {
    font-size: 2rem;
    color: #22c55e;
    letter-spacing: 2px;
}

header .subtitle {
    color: #71767b;
    font-size: 0.9rem;
    margin-top: 2px;
}

.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    flex-wrap: wrap;
    gap: 8px;
}

.user-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #22c55e;
}

.week-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    color: #1d9bf0;
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid #2f3336;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.nav-btn:hover {
    background: #1d9bf022;
}

.week-label {
    color: #71767b;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Calendar */
.calendar-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cal {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.cal th, .cal td {
    border: 1px solid #2f3336;
    padding: 10px 8px;
    text-align: center;
    vertical-align: middle;
}

.cal th {
    background: #16181c;
    font-size: 0.8rem;
    color: #71767b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal th.me {
    color: #22c55e;
    border-bottom: 2px solid #22c55e;
}

.slot-col {
    background: #16181c;
    text-align: left;
    min-width: 130px;
    white-space: nowrap;
}

.slot-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #e7e9ea;
    display: block;
}

.slot-time {
    font-size: 0.75rem;
    color: #536471;
}

.best-tag {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.65rem;
    background: #fbbf24;
    color: #000;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 700;
}

/* Best row glow */
tr.best-row td {
    background: #fbbf2408 !important;
}

tr.best-row td.slot-col {
    box-shadow: inset 3px 0 0 #fbbf24;
}

/* Cells */
.cell {
    min-width: 110px;
    transition: background 0.15s;
}

.cell.yes { background: #22c55e12; }
.cell.maybe { background: #eab30812; }
.cell.not_ideal { background: #f9731612; }
.cell.no { background: #ef444412; }

/* My cell */
.my-cell {
    background: #16181c;
}

.my-cell.yes { background: #22c55e18; }
.my-cell.maybe { background: #eab30818; }
.my-cell.not_ideal { background: #f9731618; }
.my-cell.no { background: #ef444418; }

/* Select + input */
.avail-select {
    width: 100%;
    padding: 5px 2px;
    border: 1px solid #2f3336;
    border-radius: 4px;
    background: #0f1419;
    color: #e7e9ea;
    font-size: 0.8rem;
    cursor: pointer;
    margin-bottom: 4px;
}

.avail-select:focus {
    outline: none;
    border-color: #1d9bf0;
}

.comment-input {
    width: 100%;
    padding: 4px;
    border: 1px solid #2f3336;
    border-radius: 4px;
    background: #0f1419;
    color: #e7e9ea;
    font-size: 0.75rem;
}

.comment-input::placeholder {
    color: #536471;
}

.comment-input:focus {
    outline: none;
    border-color: #1d9bf0;
}

/* Others' badges */
.avail-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.avail-badge.yes { background: #22c55e25; color: #22c55e; }
.avail-badge.maybe { background: #eab30825; color: #eab308; }
.avail-badge.not_ideal { background: #f9731625; color: #f97316; }
.avail-badge.no { background: #ef444425; color: #ef4444; }
.avail-badge.empty { background: transparent; color: #536471; }

.other-comment {
    display: block;
    font-size: 0.7rem;
    color: #536471;
    font-style: italic;
    margin-top: 3px;
    max-width: 120px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Saved flash */
.my-cell.saved {
    outline: 2px solid #22c55e;
    outline-offset: -2px;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px 0;
}

.leg {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #71767b;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.yes { background: #22c55e; }
.dot.maybe { background: #eab308; }
.dot.not_ideal { background: #f97316; }
.dot.no { background: #ef4444; }

/* Error */
.error-box {
    text-align: center;
    padding: 60px 20px;
}

.error-box h2 { margin-bottom: 12px; }

.error-box code {
    background: #16181c;
    padding: 4px 8px;
    border-radius: 4px;
    color: #1d9bf0;
}

/* Mobile */
@media (max-width: 768px) {
    .container { padding: 8px; }
    header h1 { font-size: 1.5rem; }
    .user-bar { flex-direction: column; align-items: flex-start; }
    .cal th, .cal td { padding: 6px 4px; font-size: 0.75rem; }
    .cell { min-width: 80px; }
}
