:root {
    --bg: #0f1117;
    --bg-accent: #151923;
    --surface: #171b25;
    --surface-strong: #1a1f2b;
    --surface-soft: #1f2533;
    --surface-glass: rgba(26, 31, 43, 0.78);
    --line: rgba(148, 163, 184, 0.16);
    --line-strong: rgba(148, 163, 184, 0.24);
    --text: #f8fafc;
    --text-soft: #cbd5e1;
    --text-muted: #94a3b8;
    --primary: #2dd4a8;
    --primary-strong: #14b88a;
    --primary-soft: rgba(45, 212, 168, 0.14);
    --danger: #fb7185;
    --danger-soft: rgba(251, 113, 133, 0.14);
    --warning: #fbbf24;
    --shadow-lg: 0 28px 80px rgba(3, 7, 18, 0.48);
    --shadow-md: 0 20px 48px rgba(3, 7, 18, 0.32);
    --shadow-sm: 0 14px 24px rgba(15, 23, 42, 0.22);
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --sidebar-width: 248px;
    --content-max: 1220px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Inter", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(45, 212, 168, 0.08), transparent 26%),
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 28%),
        linear-gradient(180deg, #0f1117 0%, #0a0c12 100%);
}

.auth-page {
    min-height: 100vh;
    padding: 24px;
}

.auth-page:not(.standalone-body) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-page .app-shell {
    width: min(560px, 100%);
}

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

body.drawer-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
}

textarea {
    resize: vertical;
}

code,
textarea[readonly] {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.app-shell {
    min-height: 100vh;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.68);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    z-index: 40;
}

body.drawer-open .drawer-overlay {
    opacity: 1;
    visibility: visible;
}

.drawer-toggle,
.drawer-close,
.btn-reset {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 0;
    color: inherit;
}

.drawer-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 60;
    width: 48px;
    height: 48px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}

.drawer-close {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    color: var(--text-soft);
}

.drawer-toggle svg,
.drawer-close svg,
.nav-link-icon svg {
    width: 100%;
    height: 100%;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    padding: 20px 18px;
    z-index: 50;
}

.app-sidebar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: linear-gradient(180deg, rgba(23, 27, 37, 0.96), rgba(17, 21, 30, 0.96));
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
    padding: 22px 18px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 800;
    color: #052e2b;
    background: linear-gradient(135deg, #67f7d4, #2dd4a8 55%, #0ea5a4);
    box-shadow: 0 14px 28px rgba(45, 212, 168, 0.25);
}

.brand-copy {
    display: grid;
    gap: 3px;
}

.brand-title {
    font-weight: 700;
    letter-spacing: -0.03em;
}

.brand-subtitle {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.sidebar-quick-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 16px;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: #04241f;
    font-weight: 700;
    box-shadow: 0 18px 36px rgba(45, 212, 168, 0.22);
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--text-soft);
    border: 1px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--line);
    transform: translateX(2px);
}

.nav-link.is-active {
    background: linear-gradient(180deg, rgba(45, 212, 168, 0.18), rgba(45, 212, 168, 0.08));
    border-color: rgba(45, 212, 168, 0.24);
    color: var(--text);
}

.nav-link-danger {
    color: #fecdd3;
}

.nav-link-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
}

.sidebar-meta {
    margin-top: auto;
    display: grid;
    gap: 16px;
}

.logout-form {
    margin: 0;
}

.logout-form .nav-link {
    width: 100%;
    justify-content: center;
}

.sidebar-user {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
}

.user-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.user-value {
    font-size: 0.95rem;
    font-weight: 600;
    word-break: break-word;
}

.content-shell {
    margin-left: calc(var(--sidebar-width) + 20px);
    min-height: 100vh;
    padding: 28px 28px 40px;
}

.content-inner {
    max-width: var(--content-max);
    margin: 0 auto;
}

.page-shell,
.page-stack,
.dashboard,
.timeline,
.memo-list,
.attachment-list,
.share-layout {
    display: grid;
    gap: 18px;
}

.standalone-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.standalone-page {
    width: min(1120px, 100%);
}

.panel,
.auth-card {
    position: relative;
    background: linear-gradient(180deg, rgba(23, 27, 37, 0.98), rgba(17, 21, 30, 0.98));
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    overflow: hidden;
}

.panel::before,
.auth-card::before,
.auth-hero::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
}

.topbar,
.page-header,
.share-layout {
    padding: 24px;
}

.topbar,
.page-header,
.section-heading,
.memo-card__head,
.memo-card__actions,
.attachment-item,
.share-header,
.share-box,
.button-row,
.topbar__actions {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
}

.topbar,
.page-header,
.section-heading,
.attachment-item,
.share-header,
.share-box,
.memo-card__actions,
.button-row,
.topbar__actions {
    flex-wrap: wrap;
}

.auth-card__header,
.section-heading {
    display: grid;
    gap: 8px;
}

.section-heading {
    margin-bottom: 18px;
}

.page-header,
.topbar {
    border-radius: var(--radius-lg);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.auth-brand {
    font-size: 1.15rem;
    letter-spacing: 0.12em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    margin-bottom: 0;
    letter-spacing: -0.04em;
}

h1 {
    font-size: clamp(1.8rem, 2vw, 2.35rem);
    line-height: 1.02;
}

p,
.meta,
.empty-text {
    color: var(--text-soft);
}

.meta,
.empty-text {
    font-size: 0.94rem;
}

.section-heading p,
.page-header p,
.topbar p {
    margin-bottom: 0;
}

.search-form,
.form-grid,
.install-form,
.install-section,
.auth-layout,
.hero-pills {
    display: grid;
    gap: 16px;
}

.search-form {
    flex: 1 1 360px;
}

.form-grid label,
.stack-form label {
    display: grid;
    gap: 8px;
    color: var(--text-soft);
    font-size: 0.95rem;
}

.form-grid label > span,
.stack-form label > span {
    font-weight: 600;
}

.stack-form {
    display: grid;
    gap: 16px;
}

.auth-login-form {
    margin-top: 10px;
}

.two-col {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 13px 15px;
    background: rgba(15, 23, 42, 0.64);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder,
textarea::placeholder {
    color: rgba(148, 163, 184, 0.72);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(45, 212, 168, 0.55);
    box-shadow: 0 0 0 4px rgba(45, 212, 168, 0.12), 0 12px 30px rgba(13, 17, 23, 0.26);
    background: rgba(15, 23, 42, 0.92);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.button,
.btn,
.filter-tab,
.tag-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 11px 16px;
    border-radius: 15px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button:hover,
.btn:hover,
.filter-tab:hover,
.tag-pill:hover,
.button:focus-visible,
.btn:focus-visible,
.filter-tab:focus-visible,
.tag-pill:focus-visible {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.button-primary,
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: #04241f;
    border-color: rgba(45, 212, 168, 0.54);
    box-shadow: 0 18px 36px rgba(45, 212, 168, 0.22);
}

.button-secondary {
    background: rgba(255, 255, 255, 0.05);
}

.button-ghost,
.btn-ghost,
.filter-tab {
    background: transparent;
}

.button-danger,
.btn-danger {
    color: #ffe4e6;
    border-color: rgba(251, 113, 133, 0.28);
    background: rgba(251, 113, 133, 0.08);
}

.button-block,
.btn-full {
    width: 100%;
}

.filter-tabs,
.tag-cloud,
.tag-row,
.status-badges,
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-tab.is-active,
.tag-pill.is-active {
    background: linear-gradient(180deg, rgba(45, 212, 168, 0.18), rgba(45, 212, 168, 0.08));
    border-color: rgba(45, 212, 168, 0.24);
}

.memo-card {
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 20px;
    background:
        linear-gradient(180deg, rgba(31, 37, 51, 0.94), rgba(23, 27, 37, 0.94)),
        radial-gradient(circle at top left, rgba(45, 212, 168, 0.08), transparent 24%);
    box-shadow: var(--shadow-sm);
    transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.memo-card:hover {
    transform: translateY(-4px);
    border-color: rgba(45, 212, 168, 0.24);
    box-shadow: 0 26px 48px rgba(0, 0, 0, 0.28);
}

.memo-content {
    margin: 18px 0;
}

.muted-title {
    color: var(--text-muted);
}

.badge,
.tag-link,
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 0.84rem;
    line-height: 1;
}

.badge {
    background: rgba(132, 204, 22, 0.12);
    border: 1px solid rgba(132, 204, 22, 0.18);
    color: #ecfccb;
    font-weight: 700;
}

.badge-muted {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.18);
    color: var(--text-soft);
}

.badge-accent {
    background: rgba(250, 204, 21, 0.12);
    border-color: rgba(250, 204, 21, 0.18);
    color: #fef3c7;
}

.tag-link,
.tag-pill {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.2), rgba(45, 212, 168, 0.12));
    color: #ccfbf1;
    border: 1px solid rgba(45, 212, 168, 0.16);
}

.attachment-item,
.share-box,
.warning-box {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.share-box input {
    flex: 1 1 280px;
}

.warning-box {
    color: #fde68a;
    background: rgba(250, 204, 21, 0.08);
    border-color: rgba(250, 204, 21, 0.18);
}

.danger-zone {
    border-color: rgba(251, 113, 133, 0.2);
}

.flash-stack {
    display: grid;
    gap: 12px;
}

.flash {
    border-radius: 18px;
    padding: 14px 16px;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
}

.flash-success {
    background: rgba(22, 163, 74, 0.14);
    border-color: rgba(34, 197, 94, 0.2);
    color: #d1fae5;
}

.flash-error {
    background: rgba(251, 113, 133, 0.12);
    border-color: rgba(251, 113, 133, 0.18);
    color: #ffe4e6;
}

.empty-state {
    text-align: center;
    padding: 32px 24px;
    border-radius: 22px;
    border: 1px dashed rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.03);
}

.markdown-body {
    color: var(--text-soft);
    line-height: 1.75;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body pre {
    margin-bottom: 1rem;
}

.markdown-body pre {
    overflow-x: auto;
    padding: 1rem;
    border-radius: 16px;
    background: rgba(6, 10, 18, 0.86);
    color: #fef7ef;
}

.markdown-body code {
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    background: rgba(45, 212, 168, 0.12);
}

.markdown-body pre code {
    padding: 0;
    background: transparent;
}

.auth-layout {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: 1.15fr 0.9fr;
    gap: 24px;
    align-items: stretch;
}

.auth-hero,
.auth-card {
    padding: 28px;
}

.auth-hero {
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    background:
        radial-gradient(circle at top left, rgba(45, 212, 168, 0.22), transparent 28%),
        radial-gradient(circle at 85% 15%, rgba(59, 130, 246, 0.22), transparent 24%),
        linear-gradient(160deg, rgba(20, 24, 33, 0.98), rgba(14, 17, 25, 0.92));
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
}

.auth-hero::after {
    content: "";
    position: absolute;
    inset: auto -40px -80px auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(45, 212, 168, 0.34), transparent 60%);
    filter: blur(16px);
}

.auth-hero h1 {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    margin-bottom: 16px;
}

.auth-copy {
    color: var(--text-soft);
    line-height: 1.75;
}

.hero-pills {
    margin-top: 26px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
    text-align: center;
}

.install-page .standalone-shell,
.auth-page .standalone-shell {
    padding: 28px;
}

.install-page .standalone-shell {
    align-items: flex-start;
}

.install-stack {
    width: min(1180px, 100%);
}

.install-section {
    padding: 20px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.025);
}

.memo-card__actions form,
.button-row form {
    margin: 0;
}

.share-page .standalone-page {
    width: min(860px, 100%);
}

.button-group {
    align-items: center;
}

@media (max-width: 1180px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }

    .hero-pills {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .drawer-toggle {
        display: inline-flex;
    }

    .drawer-close {
        display: inline-flex;
    }

    .app-sidebar {
        padding: 0;
        width: min(88vw, 320px);
        transform: translateX(-100%);
        transition: transform 0.28s ease;
    }

    body.drawer-open .app-sidebar {
        transform: translateX(0);
    }

    .app-sidebar-inner {
        border-radius: 0 28px 28px 0;
        height: 100vh;
    }

    .content-shell {
        margin-left: 0;
        padding: 86px 16px 28px;
    }
}

@media (max-width: 760px) {
    .two-col {
        grid-template-columns: 1fr;
    }

    .panel,
    .auth-card,
    .auth-hero,
    .topbar,
    .page-header,
    .share-layout {
        padding: 20px;
    }

    .button,
    .btn,
    .filter-tab,
    .tag-pill {
        width: 100%;
    }

    .button-row > *,
    .memo-card__actions > *,
    .topbar__actions > *,
    .share-box > * {
        width: 100%;
    }
}

@media print {
    body {
        background: #ffffff;
        color: #111827;
    }

    .app-sidebar,
    .drawer-toggle,
    .drawer-overlay,
    .logout-form,
    form,
    .button,
    .btn {
        display: none !important;
    }

    .content-shell {
        margin: 0;
        padding: 0;
    }

    .panel,
    .memo-card {
        background: #ffffff;
        color: #111827;
        border-color: #d1d5db;
        box-shadow: none;
    }
}
