
/* ========================================
   GOISTECH CRM
   Design System
======================================== */

:root {
    color-scheme: dark;
    --bg: #080f1c;
    --panel: #131e30;
    --input: #0b1424;
    --border: #253449;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --blue: #3b82f6;
    --primary: #2563eb;
    --red: #f87171;
    --yellow: #fbbf24;
    --green: #34d399;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Noto Sans JP", "Yu Gothic",
        "Meiryo", sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

h1, h2, h3, p {
    margin-top: 0;
}

h2 {
    font-size: 18px;
    margin-bottom: 20px;
}

button, input, select, textarea {
    font: inherit;
}

/* ========================================
   Buttons
======================================== */

button {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    transition: 0.15s;
}

button:hover {
    background: #253449;
    border-color: var(--blue);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-button {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    font-weight: bold;
}

.primary-button:hover {
    background: #1d4ed8;
}

button:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}

/* ========================================
   Input Fields
======================================== */

input, select, textarea {
    width: 100%;
    padding: 11px 13px;
    background: var(--input);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px #3b82f620;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

label {
    display: block;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: bold;
}

/* ========================================
   Login Screen
======================================== */

.login-screen {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background:
        radial-gradient(
            ellipse at top,
            #172d50 0%,
            #080f1c 65%
        );
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 36px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 20px 60px #00000050;
}

.brand h1 {
    margin: 0;
    color: #ffffff;
    font-size: 25px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.brand p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.5px;
}

.login-card .brand {
    text-align: center;
    margin-bottom: 36px;
}

.login-card h2 {
    text-align: center;
    letter-spacing: 3px;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#login-form button {
    margin-top: 12px;
    padding: 14px;
}

.login-footer {
    margin: 20px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

#login-error,
#case-error {
    color: var(--red);
    white-space: pre-wrap;
    font-size: 13px;
    margin: 0;
}

/* ========================================
   Header
======================================== */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 32px;
    background: #0d1728;
    border-bottom: 1px solid var(--border);
}

.user-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

#user-name {
    color: #cbd5e1;
    font-weight: bold;
}

.main-container {
    max-width: 1600px;
    margin: auto;
    padding: 28px;
}

#app-message:not(:empty) {
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
}

/* ========================================
   Dashboard
======================================== */

.dashboard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    border-top: 3px solid var(--blue);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 36px;
    line-height: 1.2;
}

.stat-card.today strong {
    color: var(--blue);
}

.stat-card.overdue {
    border-top-color: var(--red);
}

.stat-card.overdue strong {
    color: var(--red);
}

.stat-card.waiting {
    border-top-color: var(--yellow);
}

.stat-card.waiting strong {
    color: var(--yellow);
}

.stat-card.completed {
    border-top-color: var(--green);
}

.stat-card.completed strong {
    color: var(--green);
}

/* ========================================
   Toolbar
======================================== */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.toolbar input {
    flex: 1;
    min-width: 180px;
}

.toolbar select {
    width: auto;
    max-width: 100%;
    min-width: 140px;
}

/* ========================================
   Panels
======================================== */

.panel {
    padding: 24px;
    margin-bottom: 24px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    min-width: 0;
}

/* ========================================
   Calendar
======================================== */

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 12px;
}

.legend-blue {
    color: var(--blue);
}

.legend-yellow {
    color: var(--yellow);
}

.legend-red {
    color: var(--red);
}

.legend-green {
    color: var(--green);
}

#calendar {
    min-height: 450px;
}

.fc {
    --fc-border-color: #253449;
    --fc-page-bg-color: #131e30;
    --fc-neutral-bg-color: #0b1424;
    --fc-neutral-text-color: #94a3b8;
    --fc-today-bg-color: #2563eb20;
    --fc-button-bg-color: #1e293b;
    --fc-button-border-color: #334155;
    --fc-button-hover-bg-color: #334155;
    --fc-button-hover-border-color: #3b82f6;
    --fc-button-active-bg-color: #2563eb;
    --fc-button-active-border-color: #2563eb;
    --fc-event-text-color: #ffffff;
    --fc-list-event-hover-bg-color: #253449;
}

.fc .fc-toolbar-title {
    font-size: 21px;
}

.fc .fc-col-header-cell {
    background: #0d1728;
    padding: 10px 0;
}

.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number {
    color: #cbd5e1;
    text-decoration: none;
}

.fc .fc-daygrid-day-frame {
    min-height: 90px;
}

.fc .fc-daygrid-day:hover {
    background: #3b82f610;
    cursor: pointer;
}

.fc .fc-event {
    padding: 3px 5px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.fc .fc-event-title {
    white-space: normal;
    overflow-wrap: anywhere;
}

.fc .fc-day-sun .fc-col-header-cell-cushion {
    color: var(--red);
}

.fc .fc-day-sat .fc-col-header-cell-cushion {
    color: var(--blue);
}

/* ========================================
   Case List
======================================== */

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

th {
    padding: 14px 12px;
    text-align: left;
    color: var(--muted);
    background: #0d1728;
    font-size: 12px;
    white-space: nowrap;
}

td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    overflow-wrap: anywhere;
}

tbody tr:hover {
    background: #1b2a40;
}

td button {
    padding: 6px 12px;
    font-size: 12px;
}

/* ========================================
   Status and Priority
======================================== */

.status-badge,
.priority-badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.status-blue {
    background: #1e3a8a;
    color: #bfdbfe;
}

.status-yellow {
    background: #713f12;
    color: #fde68a;
}

.status-red {
    background: #7f1d1d;
    color: #fecaca;
}

.status-green {
    background: #064e3b;
    color: #a7f3d0;
}

.priority-high {
    color: var(--red);
}

.priority-medium {
    color: var(--yellow);
}

.priority-low {
    color: var(--muted);
}

.overdue-row {
    background: #7f1d1d18;
}

/* ========================================
   Case Modal
======================================== */

dialog {
    width: min(760px, 94vw);
    max-height: 90vh;
    padding: 28px;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow-y: auto;
    box-shadow: 0 20px 80px #00000080;
}

dialog::backdrop {
    background: #000000b0;
    backdrop-filter: blur(4px);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 18px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
}

#case-form,
#history-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#case-form label {
    margin-top: 6px;
}

#case-form .primary-button {
    margin-top: 16px;
    padding: 14px;
}

/* ========================================
   History
======================================== */

#history-section {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

#history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.history-item {
    padding: 16px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    border-radius: 8px;
    background: var(--input);
}

.history-meta {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
}

.history-content {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: 0;
}

/* ========================================
   Scrollbar
======================================== */

* {
    scrollbar-width: thin;
    scrollbar-color: #334155 #0b1424;
}

/* ========================================
   Responsive Design
======================================== */

@media (max-width: 900px) {

    .dashboard {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-container {
        padding: 18px;
    }

    .app-header {
        padding: 18px;
    }

    .panel {
        padding: 16px;
    }

    .fc .fc-toolbar {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 600px) {

    .app-header {
        flex-wrap: wrap;
    }

    .brand h1 {
        font-size: 21px;
    }

    .main-container {
        padding: 12px;
    }

    .dashboard {
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card strong {
        font-size: 28px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar input,
    .toolbar select,
    .toolbar button {
        width: 100%;
    }

    .panel {
        padding: 12px;
    }

    .fc .fc-toolbar-title {
        font-size: 16px;
    }

    .fc .fc-button {
        font-size: 11px;
    }

    .fc .fc-daygrid-day-frame {
        min-height: 65px;
    }

    .fc .fc-event {
        font-size: 9px;
        padding: 2px;
    }

    .calendar-legend {
        gap: 10px;
    }

    .login-card {
        padding: 24px;
    }

    dialog {
        padding: 18px;
    }
}
