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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
}

.container.wide {
    max-width: 780px;
}

h1 {
    color: #58a6ff;
    font-size: 1.5rem;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

/* Field / form styles */
.field {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.875rem;
    color: #8b949e;
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    border-color: #58a6ff;
}

input[type="file"] {
    width: 100%;
    padding: 0.5rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 0.9rem;
}

/* Buttons */
button[type="submit"] {
    width: 100%;
    padding: 0.7rem;
    background: #238636;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

button[type="submit"]:hover {
    background: #2ea043;
}

button[type="submit"]:disabled {
    background: #484f58;
    cursor: not-allowed;
}

/* Override for card action buttons that shouldn't be full-width green */
.card-actions button[type="submit"] {
    width: auto;
    margin-top: 0;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

.card-actions .btn-danger[type="submit"] {
    background: #da3633;
}

.card-actions .btn-danger[type="submit"]:hover {
    background: #f85149;
}

.card-actions .btn-secondary[type="submit"] {
    background: #30363d;
    color: #c9d1d9;
}

.card-actions .btn-secondary[type="submit"]:hover {
    background: #484f58;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.btn-primary {
    background: #238636;
    color: #fff;
}

.btn-primary:hover {
    background: #2ea043;
}

.btn-secondary {
    background: #30363d;
    color: #c9d1d9;
}

.btn-secondary:hover {
    background: #484f58;
}

.btn-danger {
    background: #da3633;
    color: #fff;
}

.btn-danger:hover {
    background: #f85149;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

.btn-cancel {
    display: inline-block;
    padding: 0.7rem;
    color: #8b949e;
    text-decoration: none;
    font-size: 0.95rem;
    text-align: center;
    margin-top: 0.5rem;
}

.btn-cancel:hover {
    color: #c9d1d9;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.form-actions button[type="submit"] {
    flex: 1;
    margin-top: 0;
}

/* Cards */
.cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.card:hover {
    border-color: #484f58;
}

.card-deleting {
    border-color: rgba(218, 54, 51, 0.4);
    background: rgba(218, 54, 51, 0.04);
}

.card-header {
    padding: 1rem 1.25rem 0.5rem;
}

.card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #e6edf3;
    line-height: 1.35;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #8b949e;
}

.card-type {
    color: #58a6ff;
}

.card-sep {
    color: #30363d;
}

.card-body {
    padding: 0 1.25rem 0.75rem;
}

.card-excerpt {
    font-size: 0.85rem;
    color: #8b949e;
    line-height: 1.5;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.25rem;
    border-top: 1px solid #21262d;
    background: rgba(0,0,0,0.15);
}

.card-timestamps {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: #484f58;
}

.card-ts {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.7rem;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.card-actions form {
    display: inline;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-updating {
    background: rgba(56, 139, 253, 0.15);
    color: #58a6ff;
    border: 1px solid rgba(56, 139, 253, 0.3);
}

.badge-updated {
    background: rgba(35, 134, 54, 0.15);
    color: #3fb950;
    border: 1px solid rgba(35, 134, 54, 0.3);
}

.badge-deleting {
    background: rgba(218, 54, 51, 0.15);
    color: #f85149;
    border: 1px solid rgba(218, 54, 51, 0.3);
}

.badge-deleted {
    background: rgba(139, 148, 158, 0.15);
    color: #8b949e;
    border: 1px solid rgba(139, 148, 158, 0.3);
}

.empty {
    color: #8b949e;
    text-align: center;
    margin-top: 2rem;
}

.empty a {
    color: #58a6ff;
}

/* Popup / overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.overlay.hidden {
    display: none;
}

.popup {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    max-width: 360px;
}

.popup p {
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.5;
}

.popup button {
    padding: 0.5rem 2rem;
    background: #58a6ff;
    color: #0d1117;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.popup button:hover {
    background: #79c0ff;
}

.hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #8b949e;
}

select option {
    background: #161b22;
    color: #c9d1d9;
}
/* Sign-in overlay */
.popup input[type="password"] {
    width: 100%;
    padding: 0.6rem;
    margin-bottom: 0.75rem;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 0.95rem;
}

.popup input[type="password"]:focus {
    outline: none;
    border-color: #58a6ff;
}

.auth-error {
    color: #f85149;
    font-size: 0.8rem;
    min-height: 1.2rem;
    margin-bottom: 0.5rem;
}
