* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}
body {
    font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: #0D0D0F;
    color: #F4F4F5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
#app {
    max-width: 420px;
    width: 100%;
}

/* ─── LOGIN ─── */
#loginScreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    gap: 10px;
}
#loginScreen h1 {
    color: #F5A623;
    font-size: 48px;
    margin-bottom: 10px;
}
#loginScreen .subtitle {
    color: #71717A;
    font-size: 16px;
    margin-bottom: 30px;
}

.pin-dots {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
}
.pin-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1E1E22;
    border: 2px solid #2E2E36;
    transition: 0.2s;
}
.pin-dot.filled {
    background: #F5A623;
    border-color: #F5A623;
}
.pin-dot.active {
    border-color: #F5A623;
    box-shadow: 0 0 15px rgba(245,166,35,0.3);
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 300px;
}
.pin-key {
    background: #1E1E22;
    border: 1px solid #2E2E36;
    border-radius: 16px;
    padding: 20px;
    font-size: 28px;
    color: #F4F4F5;
    cursor: pointer;
    transition: 0.15s;
    text-align: center;
    font-weight: 600;
}
.pin-key:active {
    transform: scale(0.92);
    background: #2E2E36;
}
.pin-key.empty {
    background: transparent;
    border: none;
    cursor: default;
    pointer-events: none;
}
.pin-key.delete {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #EF4444;
}
.pin-key.delete:active {
    background: rgba(239,68,68,0.1);
}

.login-error {
    color: #EF4444;
    font-size: 14px;
    min-height: 24px;
    margin-top: 10px;
}

.login-footer {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.login-footer .link {
    color: #71717A;
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}

/* ─── MAIN ─── */
#mainScreen {
    display: none;
    height: 80vh;
    flex-direction: column;
}
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 20px;
    flex-shrink: 0;
}
.header h1 {
    color: #F5A623;
    font-size: 24px;
}
.header-actions {
    display: flex;
    gap: 15px;
}
.header-actions button {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
}

.note-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 20px;
}
.note-item {
    background: #161618;
    border: 1px solid #2E2E36;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.note-item .content {
    flex: 1;
    cursor: pointer;
}
.note-item .title {
    font-size: 17px;
    font-weight: 600;
}
.note-item .preview {
    color: #71717A;
    font-size: 14px;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.note-item .date {
    color: #52525B;
    font-size: 11px;
    margin-top: 4px;
}
.note-item .delete {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
}

.empty {
    text-align: center;
    padding: 40px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.empty .icon {
    font-size: 52px;
}
.empty h3 {
    color: #F4F4F5;
    font-size: 18px;
    margin-top: 16px;
}
.empty p {
    color: #71717A;
    font-size: 14px;
    margin-top: 6px;
}

.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #F5A623;
    color: #000;
    width: 60px;
    height: 60px;
    border-radius: 30px;
    border: none;
    font-size: 34px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(245,166,35,0.3);
    transition: 0.2s;
    z-index: 10;
}
.fab:active {
    transform: scale(0.9);
}

/* ─── MODAL ─── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}
.modal-overlay.active {
    display: flex;
}
.modal {
    background: #1E1E22;
    border: 1px solid #2E2E36;
    border-radius: 20px;
    padding: 24px;
    max-width: 420px;
    width: 100%;
}
.modal h2 {
    text-align: center;
    font-size: 22px;
    margin-bottom: 20px;
}
.modal input,
.modal textarea {
    width: 100%;
    background: #0D0D0F;
    color: #F4F4F5;
    border: 1px solid #2E2E36;
    border-radius: 10px;
    padding: 14px;
    font-size: 16px;
    font-family: inherit;
    margin-bottom: 12px;
}
.modal textarea {
    min-height: 120px;
    resize: vertical;
}
.modal input:focus,
.modal textarea:focus {
    outline: 2px solid #F5A623;
}
.modal-actions {
    display: flex;
    gap: 12px;
}
.modal-actions button {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.modal-actions .cancel {
    background: #2E2E36;
    color: #F4F4F5;
}
.modal-actions .save {
    background: #F5A623;
    color: #000;
}

/* ─── SETTINGS ─── */
#settingsScreen {
    display: none;
    flex-direction: column;
    min-height: 80vh;
}
#settingsScreen h1 {
    color: #F5A623;
    font-size: 32px;
    text-align: center;
    padding: 20px 0;
}

.settings-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 0;
    flex: 1;
}
.settings-item {
    background: #1E1E22;
    border: 1px solid #2E2E36;
    border-radius: 14px;
    padding: 18px 20px;
    cursor: pointer;
    transition: 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.settings-item:active {
    transform: scale(0.98);
    background: #2E2E36;
}
.settings-item .label {
    font-size: 17px;
    font-weight: 500;
}
.settings-item .arrow {
    color: #71717A;
    font-size: 20px;
}
.settings-back {
    background: none;
    border: none;
    color: #F5A623;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 0;
    text-align: left;
}

/* ─── SETTINGS SUB-PAGES ─── */
.settings-page {
    display: none;
    flex-direction: column;
    gap: 15px;
}
.settings-page.active {
    display: flex;
}

.settings-pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}
.settings-pin-key {
    background: #1E1E22;
    border: 1px solid #2E2E36;
    border-radius: 14px;
    padding: 16px;
    font-size: 24px;
    color: #F4F4F5;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    transition: 0.15s;
}
.settings-pin-key:active {
    transform: scale(0.92);
    background: #2E2E36;
}
.settings-pin-key.empty {
    background: transparent;
    border: none;
    cursor: default;
    pointer-events: none;
}
.settings-pin-key.delete {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #EF4444;
}
.settings-pin-key.delete:active {
    background: rgba(239,68,68,0.1);
}

.settings-dots {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 10px 0;
}
.settings-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1E1E22;
    border: 2px solid #2E2E36;
    transition: 0.2s;
}
.settings-dot.filled {
    background: #F5A623;
    border-color: #F5A623;
}

.settings-info {
    color: #71717A;
    font-size: 14px;
    text-align: center;
}
.settings-error {
    color: #EF4444;
    font-size: 14px;
    text-align: center;
    min-height: 24px;
}
.settings-btn {
    background: #F5A623;
    color: #000;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}
.settings-btn:active {
    transform: scale(0.97);
}
.settings-btn.danger {
    background: #EF4444;
    color: #fff;
}
.settings-btn.secondary {
    background: #2E2E36;
    color: #F4F4F5;
}
.settings-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-back-btn {
    background: none;
    border: none;
    color: #F5A623;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 0;
    text-align: center;
}

/* Scrollbar */
.note-list::-webkit-scrollbar {
    width: 4px;
}
.note-list::-webkit-scrollbar-track {
    background: transparent;
}
.note-list::-webkit-scrollbar-thumb {
    background: #2E2E36;
    border-radius: 4px;
}