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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0a0f0d;
    color: #e0e8e4;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

header {
    background: #0c1410;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    border-bottom: 2px solid #ffffff;
    flex-shrink: 0;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.brand-sub {
    font-size: 11px;
    color: #4a6a5a;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.header-divider {
    width: 2px;
    height: 32px;
    background: #ffffff;
    flex-shrink: 0;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.nav-pill {
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    background: rgba(16, 185, 129, 0.06);
    padding: 6px 14px;
    border-radius: 8px;
    border: 2px solid #ffffff;
    transition: all 0.2s;
}

#model-status {
    font-size: 12px;
    margin-left: auto;
    padding: 5px 14px;
    border-radius: 20px;
    white-space: nowrap;
    font-weight: 600;
    letter-spacing: 0.3px;
}

#model-status.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

#model-status.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.left-panel {
    flex: 6;
    display: flex;
    flex-direction: column;
    background: #0a0f0d;
    min-width: 0;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: #0c1410;
    border-bottom: 2px solid #ffffff;
    flex-shrink: 0;
    overflow: visible;
}

.toolbar .btn-secondary {
    flex: 0 0 auto;
    padding: 6px 12px;
    font-size: 12px;
}

.history-row {
    cursor: pointer;
    transition: background 0.2s;
}

.history-row:hover {
    background: rgba(16, 185, 129, 0.08) !important;
}

.history-row.active {
    background: rgba(16, 185, 129, 0.12) !important;
}

.brand-sub, .toolbar-hint, .slider-label, .slider-value, .zoom-control, .placeholder-desc, .placeholder-formats, #measurements-table th, .bottom-toggle, #history-table th, .modal-close, .dw-label {
    color: #ffffff !important;
}

.placeholder-desc {
    opacity: 0.8;
}

.logo-text .brand-sub {
    opacity: 0.7;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #10b981;
    color: #ffffff;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.upload-btn:hover {
    background: #0d9668;
    transform: translateY(-1px);
}

.toolbar-hint {
    font-size: 11px;
    color: #3d5a4c;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.toolbar-separator {
    width: 2px;
    height: 24px;
    background: #ffffff;
    flex-shrink: 0;
}

.toolbar-spacer {
    flex: 1;
}

.toolbar-slider-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.toolbar-slider-group svg {
    color: #10b981;
    flex-shrink: 0;
}

.slider-label {
    font-size: 11px;
    font-weight: 600;
    color: #8aa898;
    white-space: nowrap;
}

.toolbar-slider-group input[type="range"] {
    width: 70px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #1a2e23;
    border-radius: 2px;
    outline: none;
}

.toolbar-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.35);
}

.toolbar-slider-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    border: none;
}

.slider-value {
    font-size: 11px;
    font-weight: 600;
    color: #5a7a6a;
    min-width: 32px;
    text-align: right;
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #5a7a6a;
}

.zoom-control svg {
    color: #10b981;
    flex-shrink: 0;
}

.zoom-control input[type="range"] {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #1a2e23;
    border-radius: 2px;
    outline: none;
}

.zoom-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
}

.zoom-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
}

#zoom-value {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
    color: #a0b8ac;
}

.canvas-container {
    flex: 1;
    padding: 12px;
    overflow: hidden;
    display: flex;
}

.canvas-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #060a08;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    border-radius: 12px;
    border: 2px solid #ffffff;
}

.canvas-wrapper canvas {
    display: none;
    cursor: default;
    flex-shrink: 0;
}

.placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.placeholder-content {
    text-align: center;
    padding: 40px;
}

.placeholder-icon {
    width: 64px;
    height: 64px;
    background: rgba(16, 185, 129, 0.08);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: #10b981;
}

.placeholder-title {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
}

.placeholder-desc {
    font-size: 13px;
    color: #4a6a5a;
    max-width: 280px;
    line-height: 1.5;
    margin: 0 auto 16px;
}

.placeholder-formats {
    font-size: 11px;
    color: #3d5a4c;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.right-panel {
    flex: 5;
    display: flex;
    flex-direction: column;
    min-width: 360px;
    max-width: 520px;
    overflow: hidden;
    background: #0c1410;
    border-left: 2px solid #ffffff;
}

.panel-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: rgba(16, 185, 129, 0.04);
    border-bottom: 2px solid #ffffff;
    flex-shrink: 0;
}

.section-header-icon {
    width: 28px;
    height: 28px;
    background: rgba(16, 185, 129, 0.12);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10b981;
    flex-shrink: 0;
}

.section-header h3 {
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.section-body {
    overflow-y: auto;
}

.measurements-section {
    flex: 0 0 auto;
    max-height: 38%;
    border-bottom: 2px solid #ffffff;
}

#measurements-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

#measurements-table th, #history-table th {
    background: rgba(16, 185, 129, 0.04);
    padding: 10px 16px;
    text-align: left;
    position: sticky;
    top: 0;
    color: #ffffff;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 2px solid #ffffff;
}

#measurements-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #111c16;
    color: #ffffff;
    font-weight: 500;
    font-size: 12px;
}

#measurements-table tr:hover td {
    background: rgba(16, 185, 129, 0.04);
}

.report-section {
    flex: 1;
    overflow: hidden;
    border-bottom: 2px solid #ffffff;
}

.report-body {
    padding: 16px 20px;
}

#report-text {
    font-size: 12px;
    line-height: 1.8;
    color: #ffffff;
}

#report-text b {
    color: #ffffff;
    font-weight: 700;
}

.buttons-section {
    padding: 14px 20px;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    background: #0a100e;
    border-top: 2px solid #ffffff;
}

.btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.btn-primary {
    background: #10b981;
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background: #0d9668;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    background: #ef4444;
    color: #ffffff;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: #ffffff;
    border: 2px solid #ffffff;
}

.btn-secondary:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
    color: #ffffff;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-overlay.visible {
    display: flex;
}

.modal {
    background: #0c1410;
    border: 2px solid #ffffff;
    border-radius: 16px;
    padding: 0;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 2px solid #ffffff;
    background: rgba(16, 185, 129, 0.04);
}

.modal-header h3 {
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.3px;
}

.modal-close {
    background: none;
    border: none;
    color: #4a6a5a;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.modal-body {
    padding: 28px 24px;
    text-align: center;
}

.modal-logo {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.modal-title {
    font-family: 'Roboto', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 16px;
}

.modal-body p {
    margin: 6px 0;
    font-size: 13px;
    color: #ffffff;
    line-height: 1.6;
}

.confirm-icon {
    width: 64px;
    height: 64px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    padding: 16px 24px;
    border-top: 2px solid #ffffff;
}

.confirm-actions .btn {
    flex: 1;
}

.modal-footer-text {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid #ffffff;
    color: #10b981;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 13, 0.9);
    backdrop-filter: blur(6px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.loading-overlay.visible {
    display: flex;
}

.loading-card {
    background: #0c1410;
    border: 2px solid #ffffff;
    border-radius: 16px;
    padding: 36px 52px;
    text-align: center;
}

.loading-card p {
    margin-top: 16px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #1a2e23;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #1a2e23;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2a4a3a;
}

.bottom-panel {
    flex-shrink: 0;
    background: #0c1410;
    border-top: 2px solid #ffffff;
    display: flex;
    flex-direction: column;
    max-height: 220px;
    transition: max-height 0.3s ease;
}

.bottom-panel.collapsed {
    max-height: 42px;
}

.bottom-panel.collapsed .bottom-body {
    display: none;
}

.bottom-panel.collapsed .bottom-toggle svg {
    transform: rotate(180deg);
}

.bottom-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    background: rgba(16, 185, 129, 0.04);
    border-bottom: 2px solid #ffffff;
    flex-shrink: 0;
    cursor: pointer;
}

.bottom-header h3 {
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    flex: 1;
}

.bottom-toggle {
    background: none;
    border: none;
    color: #4a6a5a;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.bottom-toggle:hover {
    color: #10b981;
}

.btn-clear-history {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    margin-left: auto;
}

.btn-clear-history:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
}

.bottom-toggle svg {
    transition: transform 0.3s ease;
}

.bottom-body {
    overflow-y: auto;
    flex: 1;
}

#history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

#history-table th {
    background: rgba(16, 185, 129, 0.04);
    padding: 8px 20px;
    text-align: left;
    position: sticky;
    top: 0;
    color: #ffffff;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 2px solid #ffffff;
}

#history-table td {
    padding: 8px 20px;
    border-bottom: 1px solid #111c16;
    color: #ffffff;
    font-weight: 500;
    font-size: 12px;
}

#history-table tr:hover td {
    background: rgba(16, 185, 129, 0.04);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.copied {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-badge.pending {
    background: rgba(234, 179, 8, 0.1);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.25);
}

.history-empty {
    text-align: center;
    padding: 20px;
    color: #4a6a5a;
    font-size: 13px;
    display: none;
}

.dicomweb-modal-content {
    max-width: 520px;
}

.dicomweb-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dicomweb-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 70vh;
    overflow-y: auto;
}

.dicomweb-section {
    border: 2px solid #ffffff;
    border-radius: 10px;
    padding: 16px;
}

.dicomweb-section h4 {
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 14px;
}

.dicomweb-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    align-items: baseline;
}

.dw-label {
    font-size: 12px;
    font-weight: 600;
    color: #4a6a5a;
    white-space: nowrap;
}

.dw-value {
    font-size: 13px;
    color: #ffffff;
    font-weight: 500;
    word-break: break-all;
}

.dw-mono {
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    color: #10b981;
}

.dw-note {
    margin-top: 14px;
    font-size: 12px;
    color: #eab308;
    line-height: 1.5;
}

.dw-info {
    font-size: 12px;
    color: #ffffff;
    line-height: 1.5;
}

.dw-sender-card {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
}

.dw-sender-card h5 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #10b981;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
