:root {
    --bg: #0b0f17;
    --card: #111827;
    --card2: #0f172a;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: rgba(255, 255, 255, .08);
    --accent: #60a5fa;
    --danger: #ef4444;
    --shadow: 0 12px 30px rgba(0, 0, 0, .45);
    --radius: 18px;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    background: radial-gradient(1100px 600px at 20% 0%, rgba(96, 165, 250, .16), transparent 55%),
        radial-gradient(900px 700px at 100% 20%, rgba(236, 72, 153, .12), transparent 55%),
        var(--bg);
    color: var(--text);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(11, 15, 23, .72);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
}

.brand {
    font-weight: 700;
    letter-spacing: .2px
}

.nav a {
    color: var(--muted);
    text-decoration: none;
    margin-left: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid transparent;
}

.nav a.active {
    color: var(--text);
    border-color: var(--border);
    background: rgba(255, 255, 255, .04);
}

.container {
    width: 100%;
    margin: 18px 0 40px;
    padding: 0 18px;
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 18px;
}

.container.container-single {
    grid-template-columns: 1fr;
}


@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr
    }
}

.card {
    background: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 40%), var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

.card.side {
    background: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 35%), var(--card2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

h1,
h2 {
    margin: 0 0 8px
}

h1 {
    font-size: 22px
}

h2 {
    font-size: 16px;
    color: var(--text)
}

.muted {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45
}

.clock-wrap {
    display: flex;
    justify-content: center;
    padding: 16px 0 6px;
}

.clock {
    width: min(420px, 88vw);
    height: auto;
    display: block;
}

/* Clock styling */
.face {
    fill: rgba(255, 255, 255, .03);
    stroke: rgba(255, 255, 255, .08);
    stroke-width: 1;
}

.pin {
    fill: rgba(255, 255, 255, .8);
}

.hand {
    stroke: rgba(255, 255, 255, .85);
    stroke-linecap: round;
    transform-origin: 100px 100px;
}

.hand.hour {
    stroke-width: 4.6;
}

.hand.minute {
    stroke-width: 3.2;
}

.hand.second {
    stroke-width: 1.6;
    stroke: rgba(239, 68, 68, .9);
}

.mark {
    stroke: rgba(255, 255, 255, .24);
    stroke-linecap: round;
}

.mark.big {
    stroke-width: 2.2;
}

.mark.small {
    stroke-width: 1.2;
    opacity: .85;
}

/* Legend */
.legend {
    margin-top: 12px;
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.legend-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.legend-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 255, 255, .02);
}

.legend-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, .18);
    flex: 0 0 auto;
}

.legend-text {
    min-width: 0;
}

.legend-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legend-sub {
    font-size: 12px;
    color: var(--muted);
}

.icon {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .03);
    object-fit: contain;
    padding: 3px;
    flex: 0 0 auto;
}

/* Buttons */
.btn {
    appearance: none;
    border: 1px solid var(--border);
    color: var(--text);
    background: rgba(255, 255, 255, .04);
    padding: 10px 12px;
    border-radius: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background: rgba(255, 255, 255, .06);
}

.btn.small {
    padding: 7px 10px;
    border-radius: 12px;
    font-size: 13px;
    color: var(--muted);
}

.btn.danger {
    border-color: rgba(239, 68, 68, .35);
    background: rgba(239, 68, 68, .12);
}

.btn.danger:hover {
    background: rgba(239, 68, 68, .18);
}

/* Settings layout */
.hours-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

@media (max-width: 900px) {
    .hours-grid {
        grid-template-columns: 1fr;
    }
}

.hour-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, .02);
}

.hour-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.hour-title {
    font-weight: 700;
}

.hour-sub {
    font-size: 12px;
    color: var(--muted);
}

.seg-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.seg-row {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px;
    background: rgba(0, 0, 0, .16);
    display: grid;
    grid-template-columns: 1.1fr 1.1fr 1fr 1.6fr 1.2fr auto;
    gap: 8px;
    align-items: center;
}

/* Collapsible hour cards */
.hour-card {
    padding: 0;
    /* details handles its own padding */
    overflow: hidden;
}

.hour-card>summary {
    list-style: none;
    cursor: pointer;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    user-select: none;
}

.hour-card>summary::-webkit-details-marker {
    display: none;
}

.hour-card .hour-body {
    padding: 0 12px 12px;
}

/* Chevron */
.hour-card>summary::after {
    content: "";
    width: 10px;
    height: 10px;
    border-right: 2px solid rgba(255, 255, 255, .55);
    border-bottom: 2px solid rgba(255, 255, 255, .55);
    transform: rotate(45deg);
    transition: transform .15s ease;
    margin-left: 10px;
    flex: 0 0 auto;
}

.hour-card[open]>summary::after {
    transform: rotate(-135deg);
}

/* Keep your existing hour-top styles usable inside summary */
.hour-top {
    margin: 0;
}


@media (max-width: 720px) {
    .seg-row {
        grid-template-columns: 1fr 1fr;
    }

    .seg-row .span2 {
        grid-column: span 2;
    }
}

label.small {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
}

input[type="url"],
input[type="text"],
select {
    width: 100%;
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .03);
    color: var(--text);
    outline: none;
}

input[type="color"] {
    width: 100%;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .03);
    padding: 4px;
}

.icon-preview {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-preview img {
    width: 26px;
    height: 26px;
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 4px;
    background: rgba(255, 255, 255, .03);
}

.row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.icon-btn {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    border-radius: 12px;
    padding: 9px 10px;
    cursor: pointer;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, .06);
}

.status {
    border: 1px solid var(--border);
    background: rgba(96, 165, 250, .12);
    padding: 10px 12px;
    border-radius: 14px;
    margin: 10px 0 12px;
    color: var(--text);
}

.status.error {
    background: rgba(239, 68, 68, .14);
    border-color: rgba(239, 68, 68, .35);
}

.footer-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.bullets {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--muted);
}

.note {
    margin-top: 12px;
    border: 1px dashed rgba(255, 255, 255, .14);
    border-radius: 16px;
    padding: 12px;
    color: var(--muted);
    background: rgba(255, 255, 255, .02);
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}