:root {
    --bg: #05070a;
    --bg-input: #111827;
    --text: #e5e7eb;
    --text-soft: #9ca3af;
    --accent-border: rgba(148, 163, 184, 0.6);
    --accent-soft: rgba(148, 163, 184, 0.12);
    --radius-pill: 999px;
    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.65);
    --shadow-chip: 0 8px 20px rgba(0, 0, 0, 0.55);
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at top left, #111827 0, #020617 48%, #020617 100%);
    color: var(--text);
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 24px 12px 24px;
}

.app-shell {
    width: 100%;
    max-width: 1120px;
    background: rgba(6, 10, 20, 0.96);
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    position: relative;
    overflow: hidden;
}

/* Layout */

.app-main {
    display: flex;
    padding: 14px;
    gap: 14px;
}

@media (max-width: 880px) {
    .app-main {
        flex-direction: column;
    }
}

/* Sidebar */

.sidebar {
    width: 220px;
    min-width: 200px;
    max-width: 260px;
    border-radius: 16px;
    border: 1px solid rgba(75, 85, 99, 0.9);
    background: radial-gradient(circle at top left, #020617 0, #020617 55%, #020617 100%);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.95);
    padding: 10px 10px 10px;
    position: relative;
    overflow: hidden;
}



.sidebar::before {
    content: "";
    position: absolute;
    inset: -120px;
    background: radial-gradient(circle at top, rgba(59, 130, 246, 0.22), transparent 55%);
    opacity: 0.6;
    pointer-events: none;
}

.sidebar-inner {
    position: relative;
    z-index: 1;
}

.sidebar-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(148, 163, 184, 0.9);
    margin-bottom: 8px;
}

.tool-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.tool-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    border-radius: 10px;
    border: 1px solid rgba(31, 41, 55, 0.9);
    background: radial-gradient(circle at top left, #020617 0, #020617 65%);
    color: var(--text-soft);
    cursor: pointer;
    font-size: 12px;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease,
        box-shadow 0.12s ease, color 0.16s ease;
}

.tool-item:hover {
    border-color: rgba(59, 130, 246, 0.7);
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.9);
}

.tool-item.active {
    border-color: rgba(156, 163, 175, 0.9);
    background: radial-gradient(circle at top left, #111827 0, #020617 55%);
    color: var(--text);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.8), 0 12px 30px rgba(15, 23, 42, 0.95);
  }

.tool-icon {
    width: 22px;
    height: 22px;
    border-radius: 9px;
    background: radial-gradient(circle at top left, #4b5563 0, #111827 50%, #020617 100%);
    border: 1px solid rgba(147, 197, 253, 0.7);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #e5edff;
}

.tool-label-main {
    font-weight: 500;
}

.tool-label-sub {
    font-size: 10px;
    opacity: 0.7;
}

/* Content */

.content {
    flex: 1;
    border-radius: 16px;
    border: 1px solid rgba(75, 85, 99, 0.9);
    background: radial-gradient(circle at top left, #020617 0, #020617 55%, #000000 100%);
    padding: 14px 14px 12px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.9);
    position: relative;
    overflow: hidden;
}

.content::before {
    content: "";
    position: absolute;
    inset: -220px;
    background:
      radial-gradient(circle at 0% 0%, rgba(148, 163, 184, 0.14), transparent 55%),
      radial-gradient(circle at 80% 0%, rgba(75, 85, 99, 0.08), transparent 50%);
    opacity: 0.7;
    pointer-events: none;
  }

.content-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.content-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.content-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.content-subtitle {
    font-size: 11px;
    color: var(--text-soft);
}

.tools-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 12px;
}

@media (max-width: 880px) {
    .tools-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.tool-panel {
    border-radius: 14px;
    border: 1px solid rgba(31, 41, 55, 0.9);
    background: linear-gradient(135deg, #020617 0%, #030712 60%, #020617 100%);
    padding: 12px 12px 10px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.95);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-bottom: 2px;
}

.tool-panel-title {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tool-panel-sub {
    font-size: 11px;
    color: var(--text-soft);
}

.tool-panel-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-label-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    align-items: center;
}

.field-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(148, 163, 184, 0.9);
}

.field-hint {
    font-size: 10px;
    color: rgba(148, 163, 184, 0.75);
}

.field-input,
.field-select,
.field-textarea {
    width: 100%;
    border-radius: 9px;
    border: 1px solid rgba(31, 41, 55, 0.95);
    background: radial-gradient(circle at top left, var(--bg-input) 0, #020617 55%);
    padding: 8px 10px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    resize: vertical;
    min-height: 34px;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.95), 0 0 0 1px rgba(59, 130, 246, 0.7),
        0 8px 22px rgba(15, 23, 42, 1);
    background: radial-gradient(circle at top left, #111827 0, #020617 65%);
}

.field-textarea {
    min-height: 120px;
}

.field-select {
    font-family: var(--font-main);
    font-size: 12px;
}

.field-inline {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.field-inline>* {
    flex: 1;
    min-width: 0;
}

.field-inline-small {
    flex: 0 0 auto;
}

.button-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    border-radius: 999px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: rgba(15, 23, 42, 0.95);
    padding: 6px 12px;
    color: var(--text-soft);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.1s ease,
        box-shadow 0.1s ease, color 0.16s ease;
}

.btn:hover {
    border-color: rgba(148, 163, 184, 0.9);
    background: rgba(15, 23, 42, 1);
    transform: translateY(-0.5px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
}

.btn-primary {
    border-color: rgba(156, 163, 175, 0.9);
    background: linear-gradient(135deg, #4b5563 0%, #374151 50%, #111827 100%);
  }

.btn-primary:hover {
    border-color: rgba(209, 213, 219, 1);
    /* lighter gray on hover */
    background: radial-gradient(circle at top left, #6b7280 0, #4b5563 40%, #020617 100%);
}

.btn-icon {
    width: 16px;
    height: 16px;
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.status-line {
    font-size: 11px;
    color: var(--text-soft);
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-top: 2px;
}

.status-line-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #4ade80;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
}

.status-dot-warn {
    background: #facc15;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.8);
}

.status-dot-error {
    background: #f97373;
    box-shadow: 0 0 12px rgba(248, 113, 113, 0.85);
}

.status-em {
    color: #e5e7eb;
    font-weight: 500;
}

/* Hide non-active panels */

.tool-panel[data-tool] {
    display: none;
}

.tool-panel[data-tool].active {
    display: flex;
}

/* Slightly larger tap targets on mobile */
html.is-mobile .btn {
    padding: 8px 14px;
    font-size: 12px;
}

/* Make the sidebar narrower on phones */
html.is-mobile .sidebar {
    width: 190px;
}

/* iOS: a bit more padding at the bottom for home indicator */
html.os-ios body {
    padding-bottom: 32px;
}

/* Android: maybe reduce blur for performance */
html.os-android .app-shell {
    backdrop-filter: blur(8px);
}