:root {
    /* Brand Colors - Modern Indigo/Slate Theme */
    --primary-hue: 220;
    --primary: hsl(var(--primary-hue), 90%, 56%);
    --primary-dark: hsl(var(--primary-hue), 90%, 45%);
    --secondary: hsl(150, 90%, 35%);
    /* Green for success/add */

    --bg-body: hsl(210, 40%, 98%);
    --bg-card: hsl(0, 0%, 100%);

    --text-main: hsl(215, 25%, 27%);
    --text-light: hsl(215, 20%, 65%);

    --border: hsl(214, 32%, 91%);
    --border-hover: hsl(var(--primary-hue), 60%, 80%);

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius: 12px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
#app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    padding-bottom: 5rem;
}

/* --- Header --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.logo-area {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.logo-placeholder {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 0.9rem;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(215, 30%, 15%);
    letter-spacing: -0.025em;
}

.app-header p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    outline: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px hsl(var(--primary-hue), 90%, 85%);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: hsl(210, 40%, 99%);
}

.btn-outline {
    background: transparent;
    border: 2px dashed var(--border);
    color: var(--primary);
    width: 100%;
    justify-content: center;
    padding: 1rem;
}

.btn-outline:hover {
    border-color: var(--primary);
    background: hsl(var(--primary-hue), 90%, 98%);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
}

.btn-icon:hover {
    color: #ef4444;
}

/* --- Forms & Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid white;
}

.card-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.25rem;
    color: var(--text-main);
}

.card-header p {
    font-size: 0.875rem;
    color: var(--text-light);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
    background: white;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.wysiwyg-editor:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px hsl(var(--primary-hue), 90%, 95%);
    outline: none;
}

.hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    display: block;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 2;
}

.input-group select {
    flex: 1;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* --- WYSIWYG --- */
.wysiwyg-container {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.wysiwyg-toolbar {
    background: hsl(210, 20%, 98%);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.wysiwyg-toolbar button {
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 0.9rem;
}

.wysiwyg-toolbar button:hover {
    background: hsl(210, 20%, 95%);
}

.wysiwyg-editor {
    min-height: 120px;
    padding: 1rem;
    font-size: 0.95rem;
}

/* --- Upload Zone --- */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    background: hsl(210, 40%, 99%);
    transition: 0.2s;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: hsl(var(--primary-hue), 90%, 98%);
}

.upload-zone p {
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.upload-zone small {
    color: var(--text-light);
}

.preview-area {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.preview-img {
    height: 80px;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    object-fit: cover;
}


/* --- Actions --- */
.actions-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}


.btn-success {
    background: var(--secondary);
    color: white;
    box-shadow: 0 4px 12px hsla(150, 90%, 35%, 0.2);
}

.btn-success:hover {
    background: hsl(150, 90%, 30%);
}

.action-buttons-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .action-buttons-group {
        grid-template-columns: 1fr;
    }
}

/* --- PRINT SYSTEM (Critical) --- */
#print-container {
    display: none;
    font-family: 'Inter', sans-serif;
    /* fallback to standard if needed */
    color: black;
    background: white;
    padding: 2cm;
    /* Standard margins */
    max-width: 210mm;
    /* A4 Width */
    margin: 0 auto;
}

@media print {
    body {
        background: white;
    }

    #app-container {
        display: none !important;
    }

    #print-container {
        display: block !important;
        width: 100%;
        max-width: none;
        padding: 0;
        margin: 0;
    }

    @page {
        margin: 2cm;
        size: A4;
    }

    /* Avoid cutting images inside items */
    .print-item {
        page-break-inside: avoid;
        border-bottom: 1px solid #ccc;
        padding-bottom: 20px;
        margin-bottom: 20px;
    }

    img {
        max-width: 100%;
        height: auto;
    }
}

/* Report Styles */
.header-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    text-align: center;
}

.header-table td {
    vertical-align: middle;
}

.center-cell h3 {
    font-size: 12pt;
    margin: 0;
    font-weight: normal;
}

.center-cell h2 {
    font-size: 14pt;
    margin: 5px 0;
    font-weight: bold;
}

.center-cell p {
    font-size: 10pt;
    margin: 0;
}

.double-line {
    border-top: 3px double black;
    margin-bottom: 1rem;
}

.doc-title {
    text-align: center;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

.doc-title h2 {
    font-size: 14pt;
    margin-bottom: 5px;
}

.doc-title h3 {
    font-size: 12pt;
    font-weight: normal;
    margin: 0;
}

.confidential-mark {
    margin-top: 10px;
    font-size: 9pt;
    color: red;
    border: 1px solid red;
    display: inline-block;
    padding: 2px 8px;
    font-weight: bold;
    letter-spacing: 1px;
}

.doc-meta {
    width: 100%;
    margin-bottom: 2rem;
    border: 1px solid black;
}

.doc-meta table {
    width: 100%;
    border-collapse: collapse;
}

.doc-meta td {
    border: 1px solid black;
    padding: 8px;
    width: 50%;
    font-size: 11pt;
}

.print-item h4 {
    background-color: #eee;
    padding: 5px;
    border-bottom: 1px solid #aaa;
    margin-bottom: 10px;
}

.print-row {
    margin-bottom: 8px;
}

.print-label {
    font-weight: bold;
    display: inline-block;
    width: 140px;
    vertical-align: top;
}

.print-value {
    display: inline-block;
    max-width: calc(100% - 150px);
}

.print-images {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.print-image-box {
    flex: 1;
    border: 1px solid #ddd;
    padding: 5px;
    text-align: center;
}

.print-image-box img {
    /* "sesuaikan tinggi jka potrait, lebar jika landscape" */
    /* We try object-contain with max dimensions */
    max-height: 250px;
    max-width: 100%;
    object-fit: contain;
}

.print-image-caption {
    font-size: 9pt;
    margin-top: 5px;
    font-style: italic;
}

.doc-footer {
    margin-top: 3rem;
    page-break-inside: avoid;
}

.signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

.sig-block {
    width: 40%;
    text-align: center;
}

.sig-space {
    height: 80px;
}

.logo-box {
    font-weight: bold;
    border: 2px solid #000;
    width: 50px;
    height: 50px;
    margin: 0 auto;
    display: grid;
    place-items: center;
}