:root {
    color-scheme: light;
    --bg: #f3f3f9;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e6e8ee;
    --accent: #15915a;
    --accent-dark: #0f7a48;
    --accent-soft: #e8f7ef;
    --sidebar: 272px;
    --topbar: 64px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, sans-serif;
}

a { color: inherit; }

button, input, select { font: inherit; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    width: var(--sidebar);
    height: 100vh;
    flex: 0 0 var(--sidebar);
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    height: var(--topbar);
    margin: 0;
    padding: 0 0.95rem;
    border-bottom: 1px solid var(--line);
    background: #f8f8fc;
    color: #2d2d33;
    text-decoration: none;
}

.brand__logo {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    flex: 0 0 auto;
}

.brand__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.08rem;
}

.brand__name {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: #2d2d33;
}

.brand__tag {
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.2;
    color: #8b909a;
}

.sidebar__scroll {
    flex: 1;
    overflow: auto;
    padding: 0.45rem 0.7rem 1rem;
}

.nav-group { margin-top: 0.85rem; }

.nav-group__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.55rem;
    color: #374151;
    font-size: 0.92rem;
    font-weight: 650;
    text-decoration: none;
}

.nav-group__label .iconify {
    color: #9ca3af;
    font-size: 0.95rem;
}

.nav-group__label.is-active { color: var(--accent-dark); }

.nav-tool {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.1rem 0;
    padding: 0.42rem 0.55rem 0.42rem 0.7rem;
    border-radius: 8px;
    color: #4b5563;
    font-size: 0.9rem;
    text-decoration: none;
}

.nav-tool:hover { background: #f3f4f6; color: #111827; }

.nav-tool.is-active {
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 600;
}

.nav-tool__icon {
    display: inline-flex;
    width: 1.1rem;
    color: #6b7280;
}

.nav-tool.is-active .nav-tool__icon { color: var(--accent); }

.sidebar__foot {
    margin: 0;
    padding: 0.75rem 1.1rem 0.9rem;
    border-top: 1px solid var(--line);
    color: #9ca3af;
    font-size: 0.75rem;
}

.nav-backdrop { display: none; }

.app__main {
    min-width: 0;
    flex: 1;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    height: var(--topbar);
    padding: 0 1rem;
    background: #f8f8fc;
    border-bottom: 1px solid var(--line);
}

.icon-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #4b5563;
    text-decoration: none;
    cursor: pointer;
}

.icon-btn:hover { background: #f3f4f6; }

.icon-btn.is-active {
    background: #fff;
    color: #f46048;
}

.topbar .icon-btn[href],
.topbar .theme-btn { display: inline-flex; }

.theme-btn__sun { display: none; }

html[data-theme="dark"] .theme-btn__moon { display: none; }
html[data-theme="dark"] .theme-btn__sun { display: inline-flex; }

.top-search {
    display: flex;
    flex: 1;
    justify-content: center;
}

.top-search__box {
    position: relative;
    width: min(560px, 100%);
}

.top-search input {
    width: 100%;
    height: 2.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    padding: 0 3.2rem 0 2.4rem;
    outline: none;
}

.top-search input:focus {
    background: var(--bg);
    border-color: #b7e4c9;
    box-shadow: 0 0 0 3px rgba(21, 145, 90, 0.12);
}

.top-search__icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.top-search__kbd {
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.1rem 0.4rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #9ca3af;
    font-family: inherit;
    font-size: 0.72rem;
}

.content {
    padding: 1.5rem 1.75rem 3rem;
}

.page-head h1,
.tool-head h1 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.page-head p,
.tool-head p,
.tool-about p {
    margin: 0.4rem 0 0;
    line-height: 1.5;
}

.section-title,
.tool-about h2 {
    margin: 0 0 0.85rem;
    font-size: 1.05rem;
    font-weight: 650;
}

.page-head,
.tool-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.tool-head { justify-content: flex-start; }

.page-head p,
.tool-head p,
.tool-about p { color: var(--muted); max-width: 42rem; }

.page-head select {
    height: 2.3rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 0 0.7rem;
}

.crumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 0.85rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent-dark); }

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.tool-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 230px;
    padding: 1.9rem 1.6rem 1.5rem;
    border: 0;
    border-radius: 16px;
    background: #fff;
    box-shadow: none;
    text-decoration: none;
}

.tool-card:hover {
    background: #fff;
    box-shadow: 0 8px 24px rgba(36, 36, 48, 0.06);
}

.tool-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    margin-bottom: 1.35rem;
    background: none;
    color: #f46048;
}

.tool-card__icon .iconify { font-size: 2.65rem; }

.tool-card__body { min-width: 0; }

.tool-card__title {
    display: block;
    color: #2d2d33;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.tool-card__summary {
    display: -webkit-box;
    margin-top: 0.7rem;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    color: #aaabaf;
    font-size: 0.8rem;
    line-height: 1.4;
}

.tool-head__icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.tool-head__icon .iconify { font-size: 1.15rem; }

.tool-chrome {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 2.4rem;
    margin-left: auto;
    padding: 0 0.9rem;
    border-radius: 999px;
    background: #fff;
    color: #2d2d33;
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    flex: 0 0 auto;
}

.tool-chrome:hover { background: #f3f4f6; }

.tool-chrome .iconify {
    font-size: 1.15rem;
    color: #f46048;
}

.empty { color: var(--muted); }

.workspace {
    padding: 1.15rem 1.1rem 1.3rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
    color: #111827;
}

.workspace .toolbox { overflow: hidden; }

.workspace .col-sm-3,
.workspace .col-md-3,
.workspace .col-sm-9,
.workspace .col-md-9,
.workspace .col-sm-12,
.workspace .col-md-12 {
    width: 100%;
    float: none;
}

.workspace .form-control,
.workspace input[type="text"],
.workspace textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    color: #111827;
    background: #fff;
}

.workspace .process,
.workspace .prepare,
.workspace .convert,
.workspace .btn.ok {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8faf9;
    color: #1f2937;
    cursor: pointer;
}

.workspace .process:hover,
.workspace .prepare:hover,
.workspace .convert:hover,
.workspace .btn.ok:hover {
    background: var(--accent-soft);
    border-color: #b7e4c9;
    color: var(--accent-dark);
}

.workspace .btn-group { display: block; }

.workspace h3,
.workspace h4,
.workspace h5,
.workspace p,
.workspace label { color: #1f2937; }

.tool-about { margin-top: 1.6rem; }

.addon-section + .addon-section { margin-top: 1.6rem; }

.addon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.addon-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 72px;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    background: #fff;
    color: #2d2d33;
    text-decoration: none;
}

.addon-card:hover { box-shadow: 0 8px 24px rgba(36, 36, 48, 0.06); }

.addon-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    background: #f3f3f9;
    color: #f46048;
    flex: 0 0 auto;
}

.addon-card__icon .iconify { font-size: 1.25rem; }

.addon-card__icon img {
    width: 2.25rem;
    height: 2.25rem;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.addon-card__icon:has(img) { background: transparent; }

.addon-card__label {
    min-width: 0;
    flex: 1;
    font-weight: 650;
    line-height: 1.3;
}

.addon-card__go {
    color: #aaabaf;
    flex: 0 0 auto;
}

.text-link {
    color: var(--accent-dark);
    font-weight: 650;
    text-decoration: none;
}

@media (min-width: 900px) {
    .workspace .col-sm-3,
    .workspace .col-md-3 {
        float: left;
        width: 34%;
    }
    .workspace .col-sm-9,
    .workspace .col-md-9 {
        float: left;
        width: 66%;
    }
}

@media (max-width: 860px) {
    .sidebar {
        position: fixed;
        z-index: 30;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        box-shadow: none;
    }
    body.nav-open .sidebar {
        transform: none;
        box-shadow: 12px 0 40px rgba(16, 24, 40, 0.12);
    }
    body.nav-open .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 25;
        border: 0;
        background: rgba(17, 24, 39, 0.28);
    }
    .icon-btn { display: inline-flex; }
    .top-search__kbd { display: none; }
    .content { padding: 1.1rem 1rem 2.5rem; }
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #141418;
    --surface: #1c1c22;
    --text: #ececf1;
    --muted: #a1a1aa;
    --line: #2c2c34;
    --accent-soft: #1a2e24;
    --accent-dark: #6ee7b7;
}

html[data-theme="dark"] .brand,
html[data-theme="dark"] .topbar {
    background: #1a1a20;
}

html[data-theme="dark"] .brand__name,
html[data-theme="dark"] .nav-group__label,
html[data-theme="dark"] .tool-card__title,
html[data-theme="dark"] .page-head h1,
html[data-theme="dark"] .tool-head h1,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .tool-about h2 {
    color: #f4f4f5;
}

html[data-theme="dark"] .brand__tag,
html[data-theme="dark"] .nav-tool,
html[data-theme="dark"] .tool-card__summary,
html[data-theme="dark"] .icon-btn {
    color: #a1a1aa;
}

html[data-theme="dark"] .nav-tool:hover,
html[data-theme="dark"] .icon-btn:hover {
    background: #2a2a32;
    color: #f4f4f5;
}

html[data-theme="dark"] .tool-card {
    background: #22222a;
}

html[data-theme="dark"] .addon-card {
    background: #22222a;
    color: #f4f4f5;
}

html[data-theme="dark"] .addon-card__icon {
    background: #141418;
}

html[data-theme="dark"] .addon-card__icon:has(img) {
    background: transparent;
}

html[data-theme="dark"] .tool-chrome {
    background: #22222a;
    color: #f4f4f5;
}

html[data-theme="dark"] .tool-chrome .iconify { color: #f46048; }

html[data-theme="dark"] .top-search input {
    border-color: #2c2c34;
}

html[data-theme="dark"] .top-search__kbd {
    background: #141418;
    border-color: #2c2c34;
    color: #a1a1aa;
}

html[data-theme="dark"] .page-head select {
    background: #22222a;
    border-color: #2c2c34;
    color: #f4f4f5;
}
