* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f4f7fb;
    color: #172033;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page-shell {
    width: min(96%, 1200px);
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.page-header {
    margin-bottom: 1.25rem;
}

.eyebrow {
    margin: 0 0 0.5rem;
    color: #356ae6;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(2rem, 5vw, 3.5rem);
}

.page-header p:last-child {
    max-width: 70rem;
    margin: 0;
    color: #526078;
    font-size: 1.05rem;
}

.uml-editor {
    overflow: hidden;
    border: 1px solid #94a3b8;
    border-radius: 0.75rem;
    background: #fff;
    color: #172554;
    box-shadow: 0 1rem 3rem rgb(23 32 51 / 10%);
}

.uml-toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.75rem;
    background: #172554;
}

.uml-toolbar button,
.uml-toolbar select,
.uml-toolbar label {
    font: inherit;
}

.uml-toolbar button,
.uml-toolbar select {
    padding: 0.45rem 0.65rem;
    border: 1px solid #93c5fd;
    border-radius: 0.35rem;
    background: #fff;
    color: #172554;
    font-weight: 650;
}

.uml-toolbar button {
    cursor: pointer;
}

.uml-toolbar button:hover,
.uml-toolbar button:focus,
.uml-toolbar select:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 1px;
    background: #dbeafe;
}

.uml-toolbar button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.uml-toolbar label {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    color: #e0f2fe;
    font-size: 0.9rem;
    font-weight: 650;
}

.uml-toolbar span {
    margin-left: auto;
    color: #e0f2fe;
    font-size: 0.9rem;
    font-weight: 650;
}

.uml-canvas {
    height: 620px;
    overflow: hidden;
    touch-action: none;
    background: radial-gradient(#bfdbfe 1px, transparent 1px);
    background-size: 16px 16px;
    cursor: grab;
}

.uml-canvas.panning {
    cursor: grabbing;
}

.uml-canvas svg {
    display: block;
    width: 100%;
    height: 100%;
    user-select: none;
}

.uml-class {
    cursor: move;
}

.uml-class rect {
    fill: #fff;
    stroke: #1d4ed8;
    stroke-width: 2;
}

.uml-class.selected rect {
    stroke: #f97316;
    stroke-width: 4;
}

.uml-header {
    fill: #dbeafe !important;
}

.uml-class text {
    fill: #172554;
    font-size: 14px;
    pointer-events: none;
}

.uml-class-name {
    font-size: 15px !important;
    font-weight: 750;
}

.uml-class line {
    stroke: #1d4ed8;
    stroke-width: 1.5;
}

.uml-relationship {
    fill: none;
    stroke: #475569;
    stroke-width: 2.5;
    cursor: pointer;
}

.uml-relationship.selected {
    stroke: #f97316;
    stroke-width: 4;
}

.uml-relationship-label {
    fill: #334155;
    font-size: 13px;
    font-weight: 650;
    pointer-events: none;
}

.uml-help {
    margin: 0;
    padding: 0.75rem 1rem 1rem;
    color: #526078;
    font-size: 0.9rem;
}

dialog {
    width: min(92vw, 34rem);
    padding: 1.25rem;
    border: 0;
    border-radius: 0.75rem;
    box-shadow: 0 1rem 4rem rgb(15 23 42 / 30%);
}

dialog::backdrop {
    background: rgb(15 23 42 / 45%);
}

dialog h2 {
    margin-top: 0;
}

dialog label {
    display: block;
    margin: 1rem 0;
    font-weight: 650;
}

dialog input,
dialog textarea,
dialog select {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.55rem;
    border: 1px solid #94a3b8;
    border-radius: 0.35rem;
    font: inherit;
}

dialog textarea {
    min-height: 6rem;
    resize: vertical;
}

dialog small {
    display: block;
    color: #64748b;
    font-weight: 400;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.dialog-actions button {
    padding: 0.55rem 0.8rem;
    border: 1px solid #94a3b8;
    border-radius: 0.35rem;
    background: #fff;
    cursor: pointer;
    font: inherit;
}

.dialog-actions button[value="save"] {
    border-color: #1d4ed8;
    background: #1d4ed8;
    color: #fff;
}

.relationship-note {
    color: #526078;
    font-size: 0.9rem;
}

@media (max-width: 700px) {
    .uml-toolbar span {
        width: 100%;
        margin-left: 0;
    }

    .uml-canvas {
        height: 500px;
    }
}
