* { box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    background: #f3f4f6;
    color: #111827;
}

header {
    background: #111827;
    color: #f9fafb;
    padding: 16px 24px;
}

header h1 {
    margin: 0;
    font-size: 20px;
}

/* main e definit în layout.php pentru consistență */

/* Grid specific pentru CPSL - folosit doar în cpsl.php */
.cpsl-grid {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 16px;
}

@media (max-width: 900px) {
    .cpsl-grid {
        grid-template-columns: 1fr;
    }
}

/* .card e definit în layout.php pentru consistență */

.card-preview {
    height: calc(100vh - 164px); /* aproximativ sub header */
    display: flex;
    flex-direction: column;
}

.card h2 {
    margin-top: 0;
    font-size: 16px;
}

label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    font-weight: 500;
}

input,
select,
button {
    font: inherit;
}

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.field {
    flex: 1 1 20px;
    min-width: 100px;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
}

input[readonly] {
    background: #f9fafb;
}

.muted {
    font-size: 12px;
    color: #6b7280;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(150px,1fr));
    gap: 12px;
    margin-top: 12px;
}

.metric {
    background: #f9fafb;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #e5e7eb;
}

.metric-title {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 18px;
    font-weight: 600;
}

.metric-unit {
    font-size: 12px;
    color: #6b7280;
    margin-left: 4px;
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

button.btn {
    border-radius: 4px;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    background: #2563eb;
    color: #f9fafb;
    font-size: 13px;
}

button.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

button.btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* SVG container */
#svgContainer {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    flex: 1;              /* umple card-preview pe verticală */
    min-height: 0;        /* important pentru flex */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#svgContainer svg {
    width: 100%;
    height: 100%;
}

/* Log */
pre#log {
    background: #111827;
    color: #e5e7eb;
    font-size: 11px;
    padding: 8px;
    border-radius: 6px;
    max-height: 120px;
    overflow: auto;
}

/* Meta table */
table.meta {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

table.meta td {
    padding: 1px 2px;
}

table.meta td:first-child {
    width: 60%;
    color: #6b7280;
}

/* CPSL: grupare sectiuni cu fieldset */
fieldset.field {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 8px 10px 10px;
    margin: 0;
}

fieldset.field legend {
    padding: 0 6px;
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
}

.meta-input {
    width: 100%;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    font-size: 12px;
}

/* Campuri editabile din tabelele de metrici/statistici sa arate ca input-urile meta */
table.meta span[contenteditable="true"] {
    display: inline-block;
    min-width: 40px;
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    font-size: 12px;
    background-color: #ffffff;
}

table.meta span[contenteditable="true"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37,99,235,0.2);
}

/* Drag&drop */
.dropzone {
    margin-top: 4px;
    padding: 12px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    text-align: center;
    background: #f9fafb;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.dropzone:hover {
    background: #f3f4f6;
}

.dropzone.dragover {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}

.dropzone-filename {
    margin-top: 8px;
    font-size: 12px;
    color: #4b5563;
}

/* Ascund input-ul de fișier clasic (folosim zona de drop) */
input[type="file"]#dxfFile {
    display: none;
}

/* Buton stilizat NDP - folosit în toată aplicația (excepție navbar) */
.ndp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 10px;
    background: #ffffff;
    color: #000;
    border: 1px solid #ddd;
    border-radius: 8px; /*999px;*/
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 2px rgba(15,23,42,0.45);
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.ndp-btn:hover {
    box-shadow: 0 4px 8px rgba(15,23,42,0.55);
    transform: translateY(-1px);
}
.ndp-btn:active {
    transform: translateY(0);
}
.ndp-btn.ndp-btn-primary {
    /*background: #2563eb;*/
    color: #2563eb;
    /*border-color: #2563eb;*/
}
.ndp-btn.ndp-btn-primary:hover {
    /*background: #1d4ed8;*/
    border-color: #1d4ed8;
}

.user-menu-dropdown .user-menu-divider {
  margin: 0.35rem 0.75rem;
  border-top: 1px solid #e5e7eb;
}