body {
  background-color: #0d1117;
  color: #c9d1d9;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
}

header {
  background-color: #161b22;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  margin: 0;
}

#masterDisplay {
  font-size: 0.9rem;
  background-color: #21262d;
  padding: 0.5rem;
  border-radius: 5px;
  margin: 0.5rem;
}

main {
  padding: 1rem;
}

#masterKeyFormContainer {
  padding: 1rem;
  border-bottom: 1px solid #30363d;
  margin-bottom: 1rem;
}

#masterKeyForm input {
  width: calc(100% - 130px);
  padding: 0.5rem;
  border-radius: 5px;
  border: 1px solid #30363d;
  background-color: #0d1117;
  color: #c9d1d9;
  margin-right: 0.5rem;
}

#masterKeyForm button {
  background-color: #238636;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  color: #ffffff;
  cursor: pointer;
}

.key-card {
  background-color: #161b22;
  border: 1px solid #30363d;
  border-radius: 5px;
  padding: 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.key-card .public-values,
.key-card .hidden-values {
  margin-bottom: 0.5rem;
  word-wrap: break-word;
}

.key-card strong {
  display: inline-block;
  width: 120px;
  margin-bottom: 0.3rem;
}

.status {
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  margin-top: 0.5rem;
  display: inline-block;
}

.status-decrypted {
  background-color: #22863a;
  cursor: pointer;
}

.status-encrypted {
  background-color: #dbab09;
}

.status-failed {
  background-color: #d73a49;
}

button {
  background-color: #238636;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  color: #ffffff;
  margin: 5px;
  cursor: pointer;
  margin-top: 0.5rem;
}

#clearStorageBtn,
#disableEncBtn {
  background-color: #d11325;
  transition: filter 0.25s ease;
}

input {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: 5px;
  border: 1px solid #30363d;
  background-color: #0d1117;
  color: #c9d1d9;
}

.delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: transparent;
  border: none;
  color: #d73a49;
  font-size: 1.2rem;
  cursor: pointer;
}

::-webkit-scrollbar {
  width: 1%;
}

::-webkit-scrollbar-thumb {
  background-color: #1a222d;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #555;
}

::-webkit-scrollbar-track {
  background-color: #2d2d2d;
}

.notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 20px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  border-radius: 10px;
  display: none;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  font-size: 1.5rem;
  text-align: center;
  z-index: 10000000;
  animation: fadeIn 0.5s ease-in-out, fadeOut 0.5s ease-in-out 1s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.notification.show {
  display: block;
  opacity: 1;
}

.notification.hidden {
  display: none;
}

#copyModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

#copyModalContent {
  background: #161b22;
  padding: 20px;
  border-radius: 5px;
  max-width: 500px;
  width: 90%;
}

#copyTextArea {
  width: 100%;
  background: #161b22;
  height: 150px;
  scrollbar-width: none;
  color: white;
  resize: none;
}

#copyButton {
  margin-top: 10px;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #161b22;
  padding: 20px;
  border-radius: 5px;
  width: auto;
  color: #c9d1d9;
  position: relative;
  max-height: 80vh;
  overflow: auto;
}

#manageMasterModalContent {
  max-width: 90%;
}

#managesecretKeysModalContent {
  max-width: 80%;
}

#masterKeysTable,
#secretKeysTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  overflow-x: auto;
  table-layout: auto;
}

#masterKeysTable th,
#secretKeysTable th,
#masterKeysTable td,
#secretKeysTable td {
  border: 1px solid #30363d;
  padding: 8px;
  text-align: left;
  word-wrap: break-word;
}

#masterKeysTable th,
#secretKeysTable th {
  background-color: #21262d;
}

#masterKeysTable td,
#secretKeysTable td {
  background-color: #161b22;
}

#masterKeysTable button, #secretKeysTable button {
  background-color: #d73a49;
  border: none;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  color: #ffffff;
  cursor: pointer;
}

@media (max-width: 768px) {
  #manageMasterModalContent {
    width: 90%;
  }

  #masterKeysTable {
    max-width: 100%;
    overflow-x: auto;
    display: block;
  }

  #masterKeysTable th,
  #masterKeysTable td {
    padding: 5px;
  }

  #masterKeysTable button {
    padding: 0.2rem 0.4rem;
  }
}

.status-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.otp-progress-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 20px;
  vertical-align: middle;
  width: 40px;
  height: 40px;
}

.progress-container {
  position: relative;
  width: 40px;
  height: 40px;
}

.progress-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #eee;
}

.progress-fill {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  background: conic-gradient(#3498db 360deg, transparent 0deg);
}

.master-key-cell {
  cursor: pointer;
}

.split-button {
  display: inline-flex;
  border: 2px solid #30363d;
  cursor: pointer;
  margin: 5px;
  background: #161b22;
  color: #c9d1d9;
  border-radius: 8px;
  overflow: auto;
}

.split-button .left,
.split-button .right {
  font-family: Arial, sans-serif;
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 13.333px;
  border: none;
}

.split-button .left {
  background: #21262d;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.split-button .right {
  background: #21262d;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

button:hover, .left:hover, .right:hover {
  filter: brightness(1.2);
  transition: filter 0.25s ease;
}

#encControls {
  margin-top: 10px;
}

#encControls span {
  font-weight: bold;
  margin-right: 10px;
}

#encControls button {
  margin-right: 5px;
}

dialog#customPromptDialog {
  width: 400px;
  max-width: 90%;
  min-height: 150px;
  padding: 20px;
  background: #161b22;
  color: #c9d1d9;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  text-align: center;
}

dialog#customPromptDialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

dialog#customPromptDialog input {
  width: 100%;
  max-width: 350px;
  padding: 8px;
  margin: 10px 0;
  background: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
  border-radius: 5px;
  text-align: center;
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 24px;
  cursor: pointer;
  color: #c9d1d9;
}

dialog#customPromptDialog button {
  padding: 8px 16px;
  margin: 5px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

dialog#customPromptDialog button#customPromptCancel {
  background: #d73a49;
  color: white;
}

dialog#customPromptDialog button#customPromptOk {
    background: #238636;
    color: white;
    transition: background-color 0.3s, color 0.3s;
}

dialog#customPromptDialog button#customPromptOk:disabled {
    background-color: #b7b7b7;
    color: #000000;
    cursor: not-allowed;
}

@media (max-width: 768px) {
  #keysContainer {
    margin-bottom: 20px;
  }

  #keysContainer button {
    margin: 5px;
  }

  .buttonContainer {
    display: flex;
    flex-wrap: wrap;
  }

  .buttonContainer > button {
    display: inline-block;
    width: calc(50% - 10px);
    box-sizing: border-box;
  }
}

.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* Слайдер */
.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.switch .slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  border-radius: 50%;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
}

.switch input:checked + .slider {
  background-color: #4caf50;
}

.switch input:checked + .slider:before {
  transform: translateX(14px);
}
