/* ===== DOMAIN HUNTER — all rules scoped to .dh-app ===== */

/* ── Design tokens ──────────────────────────────────── */
.dh-app {
    --dh-bg:       #0c0f1a;
    --dh-surface:  #111827;
    --dh-surface2: #1c2438;
    --dh-border:   rgba(255,255,255,.07);
    --dh-border2:  rgba(255,255,255,.12);
    --dh-text:     #e2e8f0;
    --dh-muted:    #4b5a72;
    --dh-muted2:   #8b9db5;
    --dh-blue:     #3b82f6;
    --dh-blue2:    #60a5fa;
    --dh-teal:     #14b8a6;
    --dh-green:    #22c55e;
    --dh-red:      #ef4444;
    --dh-amber:    #f59e0b;
    --dh-gold:     #fbbf24;
}

/* ── Reset ──────────────────────────────────────────── */
.dh-app * { box-sizing: border-box; }

.dh-app ::-webkit-scrollbar { width: 4px; height: 4px; }
.dh-app ::-webkit-scrollbar-track { background: transparent; }
.dh-app ::-webkit-scrollbar-thumb { background: var(--dh-surface2); border-radius: 4px; }
.dh-app ::-webkit-scrollbar-thumb:hover { background: var(--dh-muted); }

/* ── Shell ──────────────────────────────────────────── */
.dh-app {
    font: 13px/1.55 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--dh-bg);
    color: var(--dh-text);
    height: 760px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--dh-border2);
}

/* ── Header ─────────────────────────────────────────── */
.dh-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 52px;
    background: var(--dh-surface);
    border-bottom: 1px solid var(--dh-border2);
    flex-shrink: 0;
}

.dh-brand {
    display: flex;
    align-items: center;
    gap: 9px;
}

.dh-brand-icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--dh-blue) 0%, var(--dh-teal) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.dh-brand-name {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--dh-text);
}

.dh-brand-name span { color: var(--dh-blue2); }

.dh-version {
    font-size: 10px;
    font-weight: 600;
    background: rgba(59,130,246,.12);
    color: var(--dh-blue2);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid rgba(59,130,246,.22);
    letter-spacing: .03em;
}

/* Tab nav */
.dh-app .dh-nav {
    display: flex;
    align-items: stretch;
    height: 100%;
    gap: 0;
}

.dh-app .nav-btn {
    height: 100%;
    padding: 0 18px;
    background: transparent;
    color: var(--dh-muted2);
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    position: relative;
    top: 1px;
    transition: color .15s, border-color .15s;
}

.dh-app .nav-btn:hover { color: var(--dh-text); }

.dh-app .nav-btn.active {
    color: var(--dh-blue2);
    border-bottom-color: var(--dh-blue2);
    font-weight: 700;
}

/* ── Layout ─────────────────────────────────────────── */
.dh-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ── Sidebar ─────────────────────────────────────────── */
.dh-app aside {
    width: 256px;
    flex-shrink: 0;
    background: var(--dh-surface);
    border-right: 1px solid var(--dh-border2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.dh-sidebar-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--dh-border);
}

.dh-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dh-muted);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dh-section-label::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 10px;
    background: var(--dh-blue);
    border-radius: 2px;
    flex-shrink: 0;
}

.dh-section-label--gold::before { background: var(--dh-gold); }

/* Support section */
.dh-support {
    padding: 14px 16px;
    border-bottom: 1px solid var(--dh-border);
}

.dh-qr-row {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--dh-bg);
    border: 1px solid var(--dh-border2);
    border-radius: 8px;
    padding: 10px;
}

.dh-qr-img {
    background: #fff;
    padding: 4px;
    border-radius: 5px;
    flex-shrink: 0;
    line-height: 0;
}

.dh-qr-img img { width: 60px; height: 60px; display: block; }

.dh-qr-body { flex: 1; min-width: 0; }
.dh-qr-title { font-size: 11px; font-weight: 700; color: var(--dh-gold); margin-bottom: 3px; }
.dh-qr-sub { font-size: 10px; color: var(--dh-muted2); margin-bottom: 8px; line-height: 1.4; }

.dh-qr-btn {
    display: block;
    width: 100%;
    padding: 5px 6px;
    background: rgba(251,191,36,.08);
    border: 1px solid rgba(251,191,36,.25);
    color: var(--dh-gold);
    font-size: 10px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-radius: 5px;
    cursor: pointer;
    transition: background .15s;
}

.dh-qr-btn:hover { background: rgba(251,191,36,.18); }

/* Log area */
.dh-log-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px 16px 14px;
}

.dh-log-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 9px;
    background: var(--dh-surface2);
    border: 1px solid var(--dh-border2);
    border-bottom: none;
    border-radius: 7px 7px 0 0;
}

.dh-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dh-dot--red   { background: #ef4444; }
.dh-dot--amber { background: #f59e0b; }
.dh-dot--green { background: #22c55e; }

.dh-log-title {
    font-size: 10px;
    color: var(--dh-muted);
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-left: auto;
}

.dh-app .log-area {
    flex: 1;
    min-height: 140px;
    background: #060810;
    color: #4ade80;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 10.5px;
    line-height: 1.7;
    padding: 8px 10px;
    border: 1px solid var(--dh-border2);
    border-top: none;
    border-radius: 0 0 7px 7px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* ── Main content ───────────────────────────────────── */
.dh-app main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--dh-bg);
    min-width: 0;
}

.dh-app .tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    padding: 18px 20px 16px;
    min-height: 0;
}

.dh-app .tab-content.active { display: flex; }

/* ── Form elements ──────────────────────────────────── */
.dh-app label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--dh-muted2);
    letter-spacing: .03em;
    margin-bottom: 5px;
}

.dh-field { margin-bottom: 10px; }

.dh-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.dh-app input[type="text"],
.dh-app input[type="number"],
.dh-app textarea {
    width: 100%;
    padding: 7px 10px;
    background: var(--dh-bg);
    border: 1px solid var(--dh-border2);
    border-radius: 7px;
    color: var(--dh-text);
    font-size: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    margin: 0;
}

.dh-app input[type="text"]:focus,
.dh-app input[type="number"]:focus,
.dh-app textarea:focus {
    border-color: var(--dh-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

/* ── Buttons ───────────────────────────────────────── */
.dh-app .dh-btn {
    display: inline-block;
    width: 100%;
    padding: 9px 14px;
    border: none;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: .05em;
    text-transform: uppercase;
    text-align: center;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
}

.dh-app .dh-btn:hover { opacity: .88; }
.dh-app .dh-btn:active { transform: scale(.98); }

.dh-app .dh-btn-primary { background: var(--dh-blue); color: #fff; }
.dh-app .dh-btn-danger  { background: var(--dh-red); color: #fff; }
.dh-app .dh-btn-success { background: var(--dh-green); color: #fff; }
.dh-app .dh-btn-neutral { background: var(--dh-surface2); color: var(--dh-text); }
.dh-app .dh-btn-gold    { background: linear-gradient(135deg, #92400e, var(--dh-gold)); color: #000; }
.dh-app .dh-btn-tall    { height: 80px; }

/* ── Cards ──────────────────────────────────────────── */
.dh-app .dh-card {
    background: var(--dh-surface);
    border: 1px solid var(--dh-border);
    border-radius: 10px;
    padding: 14px;
}

.dh-app .dh-card--dim { background: rgba(255,255,255,.02); }

.dh-app .dh-mb { margin-bottom: 14px; }

/* ── Tab 1: Archive Scan ────────────────────────────── */
.dh-notice {
    background: rgba(245,158,11,.05);
    border: 1px solid rgba(245,158,11,.18);
    border-radius: 9px;
    padding: 12px 14px;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.dh-notice-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--dh-amber);
    margin-bottom: 9px;
}

.dh-notice-steps { display: flex; flex-direction: column; gap: 5px; }

.dh-step {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 11px;
    color: var(--dh-muted2);
    line-height: 1.5;
}

.dh-step-n {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    background: rgba(245,158,11,.15);
    color: var(--dh-amber);
    font-size: 9px;
    font-weight: 800;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dh-results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.dh-results-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--dh-muted2);
    letter-spacing: .04em;
    text-transform: uppercase;
}

#stat-pill {
    font-size: 11px;
    font-weight: 700;
    color: var(--dh-teal);
    background: rgba(20,184,166,.1);
    border: 1px solid rgba(20,184,166,.25);
    padding: 3px 10px;
    border-radius: 999px;
}

.dh-app #outLv3 {
    flex: 1;
    resize: none;
    font-size: 12px;
    line-height: 1.8;
    min-height: 0;
    margin-bottom: 10px;
}

.dh-action-row {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.dh-action-row .dh-btn { flex: 1; }

/* ── Tab 2: History Check ───────────────────────────── */
.dh-t2-controls {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.dh-t2-input-col { flex: 1; min-width: 0; }
.dh-t2-input-col textarea { height: 80px; resize: none; }

.dh-t2-options-col { width: 138px; flex-shrink: 0; }

/* ── Tab 3: Beast Check ─────────────────────────────── */
.dh-beast-notice {
    background: rgba(20,184,166,.05);
    border: 1px solid rgba(20,184,166,.2);
    border-radius: 9px;
    padding: 12px 14px;
    flex-shrink: 0;
}

.dh-beast-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--dh-teal);
    margin-bottom: 5px;
}

.dh-beast-notice p {
    font-size: 11px;
    color: var(--dh-muted2);
    margin: 0;
    line-height: 1.55;
}

.dh-t3-controls {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.dh-t3-input-col { flex: 1; min-width: 0; }
.dh-t3-input-col textarea { height: 80px; resize: none; }
.dh-t3-btn-col { flex-shrink: 0; width: 110px; }

/* ── Shared table ───────────────────────────────────── */
.dh-table-wrap {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--dh-border2);
    border-radius: 10px;
    background: var(--dh-surface);
    min-height: 0;
}

.dh-app table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.dh-app thead th {
    padding: 10px 12px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--dh-muted);
    background: var(--dh-surface);
    border-bottom: 1px solid var(--dh-border2);
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}

.dh-app tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--dh-border);
    vertical-align: middle;
}

.dh-app tbody tr:last-child td { border-bottom: none; }
.dh-app tbody tr:hover td { background: rgba(255,255,255,.025); }

.dh-app .tag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .03em;
}

.dh-app .tag.pass  { background: rgba(34,197,94,.1);  color: #22c55e; border: 1px solid rgba(34,197,94,.3); }
.dh-app .tag.fail  { background: rgba(239,68,68,.1);  color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.dh-app .tag.avail { background: rgba(20,184,166,.1); color: var(--dh-teal); border: 1px solid rgba(20,184,166,.3); }

/* ── Tab 4: Feng Shui ───────────────────────────────── */
.dh-fengshui-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.dh-fengshui-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.dh-app .dh-pt-card {
    border-color: rgba(251,191,36,.22);
    background: linear-gradient(160deg, rgba(251,191,36,.04) 0%, transparent 60%);
    position: relative;
    overflow-y: auto;
}

.dh-app .dh-pt-card::after {
    content: "☯";
    position: absolute;
    right: -12px;
    bottom: -22px;
    font-size: 110px;
    opacity: .04;
    color: var(--dh-gold);
    pointer-events: none;
    user-select: none;
}

.dh-pt-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(251,191,36,.15);
}

.dh-pt-icon { font-size: 26px; line-height: 1; }

.dh-pt-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--dh-gold);
    letter-spacing: -.01em;
}

.dh-pt-subtitle { font-size: 10px; color: var(--dh-muted2); margin-top: 2px; }

.dh-pt-section {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dh-gold);
    opacity: .65;
    margin: 16px 0 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(251,191,36,.1);
}

.dh-app .pt-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--dh-border);
}

.dh-app .pt-row:last-of-type { border-bottom: none; }

.dh-app .pt-label {
    flex-shrink: 0;
    width: 115px;
    font-size: 11px;
    color: var(--dh-muted2);
}

.dh-app .pt-val {
    font-size: 12px;
    font-weight: 700;
    color: var(--dh-text);
}

#res-star { color: var(--dh-teal) !important; }

.dh-pt-advice {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(251,191,36,.05);
    border-left: 2px solid rgba(251,191,36,.5);
    border-radius: 0 6px 6px 0;
    font-size: 11px;
    font-style: italic;
    color: var(--dh-muted2);
    line-height: 1.7;
}

.dh-italic-note {
    font-size: 11px;
    color: var(--dh-muted2);
    font-style: italic;
    line-height: 1.65;
    margin: 0;
}

/* ── Footer ─────────────────────────────────────────── */
.dh-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 34px;
    background: var(--dh-surface);
    border-top: 1px solid var(--dh-border2);
    flex-shrink: 0;
}

.dh-footer-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--dh-muted2);
}

.dh-footer-sep {
    width: 1px;
    height: 11px;
    background: var(--dh-border2);
}

.dh-footer-right {
    font-size: 10px;
    color: var(--dh-muted);
    letter-spacing: .04em;
}

/* ── Sortable column headers (Beast Check table) ────── */
.dh-app .dh-th-sort {
    cursor: pointer;
    user-select: none;
    transition: color .15s, background .15s;
}

.dh-app .dh-th-sort:hover {
    color: var(--dh-muted2);
    background: rgba(255,255,255,.03);
}

.dh-app .dh-th-sort::after {
    content: ' ⇅';
    font-size: 9px;
    opacity: .22;
    display: inline-block;
    margin-left: 3px;
}

.dh-app .dh-th-sort.dh-sort-asc,
.dh-app .dh-th-sort.dh-sort-desc {
    color: var(--dh-blue2);
    background: rgba(59,130,246,.07);
}

.dh-app .dh-th-sort.dh-sort-asc::after {
    content: ' ↑';
    opacity: 1;
    color: var(--dh-blue2);
}

.dh-app .dh-th-sort.dh-sort-desc::after {
    content: ' ↓';
    opacity: 1;
    color: var(--dh-blue2);
}

/* ── Checkbox column ────────────────────────────────── */
.dh-app .dh-cb-cell {
    width: 36px;
    text-align: center;
    padding-left: 8px;
    padding-right: 0;
}

.dh-app input[type="checkbox"].dh-row-cb,
.dh-app #t3-header-cb {
    accent-color: var(--dh-blue);
    width: 14px;
    height: 14px;
    cursor: pointer;
    vertical-align: middle;
}

/* ── Domain cell + hover quick actions ──────────────── */
.dh-app .dh-domain-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.dh-app .dh-domain-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: var(--dh-text);
}

.dh-app .dh-row-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity .15s;
}

.dh-app tbody tr:hover .dh-row-actions {
    opacity: 1;
}

.dh-app .dh-ra-btn {
    background: var(--dh-surface2);
    border: 1px solid var(--dh-border2);
    border-radius: 4px;
    color: var(--dh-muted2);
    font-size: 10px;
    padding: 2px 7px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .12s, background .12s, border-color .12s;
    line-height: 1.6;
}

.dh-app .dh-ra-btn:hover {
    background: var(--dh-blue);
    border-color: var(--dh-blue);
    color: #fff;
}

/* ── Floating bulk action bar ───────────────────────── */
.dh-app {
    position: relative;
}

.dh-bulk-bar {
    position: absolute;
    bottom: 44px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--dh-surface2);
    border: 1px solid var(--dh-border2);
    border-radius: 10px;
    padding: 8px 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,.45);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 50;
}

.dh-bulk-bar.dh-bulk-bar--visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dh-bulk-count {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--dh-muted2);
    white-space: nowrap;
}

.dh-bulk-count strong {
    color: var(--dh-blue2);
    font-size: 13px;
}

.dh-bulk-sep {
    width: 1px;
    height: 18px;
    background: var(--dh-border2);
    flex-shrink: 0;
}

.dh-bulk-actions {
    display: flex;
    gap: 6px;
}

.dh-bulk-btn {
    background: var(--dh-surface);
    border: 1px solid var(--dh-border2);
    border-radius: 6px;
    color: var(--dh-muted2);
    font-size: 11px;
    padding: 4px 12px;
    cursor: pointer;
    transition: color .12s, background .12s, border-color .12s;
    white-space: nowrap;
    line-height: 1.6;
}

.dh-bulk-btn:hover {
    background: var(--dh-blue);
    border-color: var(--dh-blue);
    color: #fff;
}

.dh-bulk-btn--clear {
    color: var(--dh-red);
    border-color: rgba(239,68,68,.3);
}

.dh-bulk-btn--clear:hover {
    background: var(--dh-red);
    border-color: var(--dh-red);
    color: #fff;
}

/* ── Guest message ──────────────────────────────────── */
.dh-guest-message {
    padding: 1.5rem;
    color: var(--dh-muted2);
    font-size: 13px;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 680px) {
    .dh-app aside { width: 220px; }
    .dh-app .nav-btn { padding: 0 12px; font-size: 11px; }
    .dh-brand-name { display: none; }
}

@media (max-width: 500px) {
    .dh-app { height: auto; min-height: 520px; }
    .dh-wrapper { flex-direction: column; }
    .dh-app aside { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--dh-border2); overflow-y: visible; }
    .dh-fengshui-grid { grid-template-columns: 1fr; }
}
